mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 14:50:41 -07:00
1b7ebd6fc2
## Link to GitHub Issue, if one exists n/a ## Description of change Adds Mahjong Fight Girl Support ## Compiling + ## Testing Tested with VFG:J:E:A:2024100800 in HG mode with VFG IO. No modifications made to data, other than avs-config.xml and ea3-config.xml. B and C modes don't work because of serial touchscreen. UKS mode doesn't work because of IO.
75 lines
1.7 KiB
C++
75 lines
1.7 KiB
C++
#include "handle.h"
|
|
|
|
#include "misc/eamuse.h"
|
|
#include "rawinput/rawinput.h"
|
|
#include "util/utils.h"
|
|
|
|
acioemu::ACIOHandle::ACIOHandle(LPCWSTR lpCOMPort, uint8_t iccaNodeCount) {
|
|
this->com_port = lpCOMPort;
|
|
this->icca_node_count = iccaNodeCount;
|
|
}
|
|
|
|
bool acioemu::ACIOHandle::open(LPCWSTR lpFileName) {
|
|
if (wcscmp(lpFileName, com_port) != 0) {
|
|
return false;
|
|
}
|
|
|
|
log_info("acioemu", "Opened {} (ACIO)", ws2s(com_port));
|
|
|
|
// ACIO device
|
|
acio_emu.add_device(new acioemu::ICCADevice(false, true, icca_node_count));
|
|
|
|
return true;
|
|
}
|
|
|
|
int acioemu::ACIOHandle::read(LPVOID lpBuffer, DWORD nNumberOfBytesToRead) {
|
|
auto buffer = reinterpret_cast<uint8_t *>(lpBuffer);
|
|
|
|
// read from emu
|
|
DWORD bytes_read = 0;
|
|
while (bytes_read < nNumberOfBytesToRead) {
|
|
auto cur_byte = acio_emu.read();
|
|
|
|
if (cur_byte.has_value()) {
|
|
buffer[bytes_read++] = cur_byte.value();
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
|
|
// return amount of bytes read
|
|
return (int) bytes_read;
|
|
}
|
|
|
|
int acioemu::ACIOHandle::write(LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite) {
|
|
auto buffer = reinterpret_cast<const uint8_t *>(lpBuffer);
|
|
|
|
// write to emu
|
|
for (DWORD i = 0; i < nNumberOfBytesToWrite; i++) {
|
|
acio_emu.write(buffer[i]);
|
|
}
|
|
|
|
// return all data written
|
|
return (int) nNumberOfBytesToWrite;
|
|
}
|
|
|
|
int acioemu::ACIOHandle::device_io(
|
|
DWORD dwIoControlCode,
|
|
LPVOID lpInBuffer,
|
|
DWORD nInBufferSize,
|
|
LPVOID lpOutBuffer,
|
|
DWORD nOutBufferSize
|
|
) {
|
|
return -1;
|
|
}
|
|
|
|
size_t acioemu::ACIOHandle::bytes_available() {
|
|
return acio_emu.bytes_available();
|
|
}
|
|
|
|
bool acioemu::ACIOHandle::close() {
|
|
log_info("acioemu", "Closed {} (ACIO)", ws2s(com_port));
|
|
|
|
return true;
|
|
}
|