kemono: Pre-generate printer firmware files

This commit is contained in:
kyoubate-haruka 2024-09-19 13:46:49 +02:00
parent 86556ed2c8
commit f6c12fd230
3 changed files with 25 additions and 2 deletions

View File

@ -1667,6 +1667,7 @@ int WINAPI fwdlusb_getPrinterInfo(uint16_t tagNumber, uint8_t *rBuffer, uint32_t
if (*rLen != 0x99) *rLen = 0x99;
if (rBuffer) {
memset(rBuffer, 0, *rLen);
rBuffer[0] = 4; // firmware count
// bootFirmware
int i = 1;
memcpy(rBuffer + i, mainFirmware, sizeof(mainFirmware));
@ -2157,6 +2158,7 @@ int WINAPI chcusb_getPrinterInfo(uint16_t tagNumber, uint8_t *rBuffer, uint32_t
if (*rLen != 0x99) *rLen = 0x99;
if (rBuffer) {
memset(rBuffer, 0, *rLen);
rBuffer[0] = 4; // firmware count
// bootFirmware
int i = 1;
memcpy(rBuffer + i, mainFirmware, sizeof(mainFirmware));

View File

@ -2,6 +2,7 @@
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
struct printer_config {
bool enable;
@ -15,4 +16,8 @@ struct printer_config {
void printer_hook_init(const struct printer_config *cfg, int rfid_port_no, HINSTANCE self);
void printer_hook_insert_hooks(HMODULE target);
void printer_set_dimensions(int width, int height);
int WINAPI fwdlusb_updateFirmware_main(uint8_t update, LPCSTR filename, uint16_t *rResult);
int WINAPI fwdlusb_updateFirmware_dsp(uint8_t update, LPCSTR filename, uint16_t *rResult);
int WINAPI fwdlusb_updateFirmware_param(uint8_t update, LPCSTR filename, uint16_t *rResult);

View File

@ -40,8 +40,24 @@ static DWORD CALLBACK kemono_pre_startup(void) {
dvd_hook_init(&kemono_hook_cfg.dvd, kemono_hook_mod);
serial_hook_init();
// 2.02 does not call printer update functions
uint16_t ret;
fwdlusb_updateFirmware_main(1, "UnityApp\\Parade_Data\\StreamingAssets\\Printer\\E0223100-014E-C300-MAINAPP.BIN", &ret);
if (ret != 0){
goto fail;
}
fwdlusb_updateFirmware_dsp(2, "UnityApp\\Parade_Data\\StreamingAssets\\Printer\\E0223200-0101-C300-DSPAPP.BIN", &ret);
if (ret != 0){
goto fail;
}
fwdlusb_updateFirmware_param(3, "UnityApp\\Parade_Data\\StreamingAssets\\Printer\\D0460700-0101-C300-PARAM.BIN", &ret);
if (ret != 0){
goto fail;
}
printer_hook_init(&kemono_hook_cfg.printer, 0, kemono_hook_mod);
printer_set_dimensions(720, 1028);
printer_set_dimensions(720, 1028); // printer doesn't call setimageformat
/* Initialize emulation hooks */