mirror of
https://gitea.tendokyu.moe/Hay1tsme/segatools.git
synced 2026-05-09 04:03:03 -05:00
This adds full support for the Taisen series of games, namely Sangokushi Taisen and Eiketsu Taisen. Games added: * Sangokushi Taisen (SDDD) * Eiketsu Taisen (SDGY) Devices added: * CHC-320 printer (SGT) * "Printer camera" (SGT, unsure what this actually really is) * CX-7000 printer (EKT) * Y3CR BD SIE F720MM (SGT, EKT) Notable changes in the codebase: * Renamed everything printer specific to seperate between CHC and CX. * Many new function and registry hooks were added across the board. * An error is now logged when segatools.ini (or the path in `SEGATOOLS_CONFIG_PATH`) cannot be found. * Netenv now redirects UDP broadcasts targeted at the subnet that is specified in the keychip configuration. The terminal announces it's presence by broadcasting UDP to 192.168.189.255, this will be redirected to 255.255.255.255. * Vfs now seperates between absolute and relative paths in `vfs_fixup_path` via an environment variable called `SEGATOOLS_VFS_RELATIVE_PATH`. This is needed because amcapture accesses files as workingdirectory-relative. * The Y3 board emulation has support for external Y3 I/O dlls. The default implementation (y3ws) that comes with this is a websocket implementation. The docs are available under `doc\y3ws.txt` and a sample card player .html file is under `dist\ekt\card_player.html`. I already know one person that is hosting a massively improved version of it. * For websockets, my own websocket implementation is used as a subproject (MIT license): https://github.com/akechi-haruka/cwinwebsocket * For JSON, cJSON was embedded (MIT license): https://github.com/DaveGamble/cJSON * y3ws reads all printed cards from `DEVICE\print` by default including card back sides. It's up to the client to merge or skip them. Remarks: * SGT takes ~8 minutes to load. This seems to be intentional. * SGT uses some weird TCP network implementation like IDZ. I have not bothered reversing that yet and I have confirmed everything working from the test menu. * EKT will throw a network error if no terminal is found. You must run the terminal on another computer to be able to launch the satellite. * EKT has a very bizzare speed glitch that will speed up the ingame unit movement by several 1000% and also slows down cutscene animations by 90%. When this effect is active, you also take a ton more damage than usual. I do not know what causes this and it seems PC specific. * EKT is very stutter sensitive and will throw error 6401 (I/O timeout) at random when trying to alt+tab or have other things running. * EKT features a livestream system called Enbu (or "Dojo Upload"). While you are in a match, regardless of vs. AI or another player, the game will record your screen and live-stream it to the Enbu server as defined by the game server's startup response. The application responsible for that, "AM Capture" will not limit it's recording to the game window, but also anything that overlays the game window (notifications, popups, alt+tabbed windows, web browsers, etc). Since this is live-streamed, killing the process will have no effect afterwards, as the frames showing unwanted things will already have been transmitted. To make people aware of this, a one-time dialog message will pop up when starting EKT. The flag for that is stored in the DEVICE folder. Closes #25. Co-authored-by: Dniel97 <Dniel97@noreply.gitea.tendokyu.moe> Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/85 Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
266 lines
6.7 KiB
C
266 lines
6.7 KiB
C
#pragma once
|
|
|
|
#include <windows.h>
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
/*
|
|
Get the version of the Aime IO API that this DLL supports. This function
|
|
should return a positive 16-bit integer, where the high byte is the major
|
|
version and the low byte is the minor version (as defined by the Semantic
|
|
Versioning standard).
|
|
|
|
The latest API version as of this writing is 0x0101.
|
|
*/
|
|
uint16_t aime_io_get_api_version(void);
|
|
|
|
/*
|
|
Initialize Aime IO provider DLL. Only called once, before any other
|
|
functions exported from this DLL are called (except for
|
|
aime_io_get_api_version).
|
|
|
|
Minimum API version: 0x0100
|
|
*/
|
|
HRESULT aime_io_init(void);
|
|
|
|
/*
|
|
Poll for IC cards in the vicinity.
|
|
|
|
- unit_no: 0 on the primary Aime reader (most games), may be 1 on Sangokushi Taisen for the queue reader
|
|
|
|
Minimum API version: 0x0100
|
|
*/
|
|
HRESULT aime_io_nfc_poll(uint8_t unit_no);
|
|
|
|
/*
|
|
Attempt to read out a classic Aime card ID
|
|
|
|
- unit_no: 0 on the primary Aime reader (most games), may be 1 on Sangokushi Taisen for the queue reader
|
|
- luid: Pointer to a ten-byte buffer that will receive the ID
|
|
- luid_size: Size of the buffer at *luid. Always 10.
|
|
|
|
Returns:
|
|
|
|
- S_OK if a classic Aime is present and was read successfully
|
|
- S_FALSE if no classic Aime card is present (*luid will be ignored)
|
|
- Any HRESULT error if an error occured.
|
|
|
|
Minimum API version: 0x0100
|
|
*/
|
|
HRESULT aime_io_nfc_get_aime_id(
|
|
uint8_t unit_no,
|
|
uint8_t *luid,
|
|
size_t luid_size);
|
|
|
|
/*
|
|
Attempt to read out a FeliCa card ID ("IDm"). The following are examples
|
|
of FeliCa cards:
|
|
|
|
- Amuse IC (which includes new-style Aime-branded cards, among others)
|
|
- Smartphones with FeliCa NFC capability (uncommon outside Japan)
|
|
- Various Japanese e-cash cards and train passes
|
|
|
|
Parameters:
|
|
|
|
- unit_no: 0 on the primary Aime reader (most games), may be 1 on Sangokushi Taisen for the queue reader
|
|
- IDm: Output parameter that will receive the card ID
|
|
|
|
Returns:
|
|
|
|
- S_OK if a FeliCa device is present and was read successfully
|
|
- S_FALSE if no FeliCa device is present (*IDm will be ignored)
|
|
- Any HRESULT error if an error occured.
|
|
|
|
Minimum API version: 0x0100
|
|
*/
|
|
HRESULT aime_io_nfc_get_felica_id(uint8_t unit_no, uint64_t *IDm);
|
|
|
|
/*
|
|
MIFARE key selector values used by the set key/authenticate functions.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
enum {
|
|
AIME_IO_MIFARE_KEY_AIME = 0,
|
|
AIME_IO_MIFARE_KEY_BANA = 1,
|
|
};
|
|
|
|
/*
|
|
Attempt to read the 4-byte MIFARE UID of the currently present card.
|
|
|
|
Parameters:
|
|
|
|
- unit_no: Always 0 as of the current API version
|
|
- uid: Pointer to a four-byte buffer that will receive the UID
|
|
- uid_size: Size of the buffer at *uid. Always 4.
|
|
|
|
Returns:
|
|
|
|
- S_OK if a MIFARE card is present and the UID was read successfully
|
|
- S_FALSE if no MIFARE card is present (*uid will be ignored)
|
|
- Any HRESULT error if an error occured.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_get_mifare_uid(
|
|
uint8_t unit_no,
|
|
uint8_t *uid,
|
|
size_t uid_size);
|
|
|
|
/*
|
|
Select a MIFARE card by UID (optional for real readers).
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_mifare_select(
|
|
uint8_t unit_no,
|
|
const uint8_t *uid,
|
|
size_t uid_size);
|
|
|
|
/*
|
|
Supply a MIFARE authentication key to the reader.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_mifare_set_key(
|
|
uint8_t unit_no,
|
|
uint8_t key_type,
|
|
const uint8_t *key,
|
|
size_t key_size);
|
|
|
|
/*
|
|
Perform a MIFARE authentication sequence.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_mifare_authenticate(
|
|
uint8_t unit_no,
|
|
uint8_t key_type,
|
|
const uint8_t *payload,
|
|
size_t payload_size);
|
|
|
|
/*
|
|
Read a 16-byte MIFARE block from the card.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_mifare_read_block(
|
|
uint8_t unit_no,
|
|
const uint8_t *uid,
|
|
size_t uid_size,
|
|
uint8_t block_no,
|
|
uint8_t *block,
|
|
size_t block_size);
|
|
|
|
/*
|
|
Forward a raw FeliCa request to a real reader.
|
|
|
|
Parameters:
|
|
|
|
- req: FeliCa request buffer, including the length byte
|
|
- res: FeliCa response buffer, including the length byte
|
|
- res_size_written: Output size of the response (bytes written to *res)
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_felica_transact(
|
|
uint8_t unit_no,
|
|
const uint8_t *req,
|
|
size_t req_size,
|
|
uint8_t *res,
|
|
size_t res_size,
|
|
size_t *res_size_written);
|
|
|
|
/*
|
|
Enable the reader's RF field.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_radio_on(uint8_t unit_no);
|
|
|
|
/*
|
|
Disable the reader's RF field.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_radio_off(uint8_t unit_no);
|
|
|
|
/*
|
|
Put the reader into firmware update mode.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_to_update_mode(uint8_t unit_no);
|
|
|
|
/*
|
|
Forward a raw hex-data command to the reader.
|
|
|
|
Parameters:
|
|
|
|
- payload: Command payload bytes
|
|
- payload_size: Size of the payload
|
|
- status_out: Optional pointer to receive the SG status byte
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
HRESULT aime_io_nfc_send_hex_data(
|
|
uint8_t unit_no,
|
|
const uint8_t *payload,
|
|
size_t payload_size,
|
|
uint8_t *status_out);
|
|
|
|
/*
|
|
Change the color and brightness of the card reader's RGB lighting
|
|
|
|
- unit_no: 0 on the primary Aime reader (most games), may be 1 on Sangokushi Taisen for the queue reader
|
|
- r, g, b: Primary color intensity, from 0 to 255 inclusive.
|
|
|
|
Minimum API version: 0x0100
|
|
*/
|
|
void aime_io_led_set_color(uint8_t unit_no, uint8_t r, uint8_t g, uint8_t b);
|
|
|
|
/*
|
|
VFD text forwarding. This is intended to pass through the text payload
|
|
plus the most recent VFD state so external handlers can emulate scrolling
|
|
or layout if desired.
|
|
|
|
- text: Pointer to raw text bytes (not null-terminated)
|
|
- text_len: Length of the text buffer
|
|
- state: Current VFD state at the time of rendering
|
|
|
|
The encoding field uses VFD encoding values (0=GB2312, 1=Big5,
|
|
2=Shift-JIS, 3=KSC5601).
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
struct aime_io_vfd_state {
|
|
uint8_t encoding;
|
|
uint8_t text_speed;
|
|
uint8_t scroll_enabled;
|
|
uint16_t h_scroll;
|
|
uint16_t cursor_x;
|
|
uint8_t cursor_y;
|
|
uint16_t wnd_x0;
|
|
uint8_t wnd_y0;
|
|
uint16_t wnd_x1;
|
|
uint8_t wnd_y1;
|
|
uint8_t rotate;
|
|
uint8_t brightness;
|
|
uint8_t screen_on;
|
|
uint32_t clear_seq;
|
|
};
|
|
|
|
void aime_io_vfd_set_text(
|
|
const uint8_t *text,
|
|
size_t text_len,
|
|
const struct aime_io_vfd_state *state);
|
|
|
|
/*
|
|
VFD state change notification. Called when the VFD state changes even
|
|
when no text is written.
|
|
|
|
Minimum API version: 0x0101
|
|
*/
|
|
void aime_io_vfd_set_state(const struct aime_io_vfd_state *state);
|