diff --git a/src/libkswapapi/libkswapapi.o b/src/libkswapapi/libkswapapi.o new file mode 100644 index 0000000..0ae0ad7 Binary files /dev/null and b/src/libkswapapi/libkswapapi.o differ diff --git a/src/lindbergh/config.c b/src/lindbergh/config.c index 14a161b..3dba27d 100644 --- a/src/lindbergh/config.c +++ b/src/lindbergh/config.c @@ -430,8 +430,8 @@ int initConfig() config.width = 1024; config.height = 768; config.crc32 = elf_crc; - config.region = US; - config.freeplay = 1; + config.region = -1; + config.freeplay = -1; if (detectGame(config.crc32) != 0) { printf("Warning: Unsure what game with CRC 0x%X is. Please submit this new game to the GitHub repository: https://github.com/bobbydilley/lindbergh-loader/issues/new?title=Please+add+new+game+0x%X&body=I+tried+to+launch+the+following+game:\n", config.crc32, config.crc32); diff --git a/src/lindbergh/eeprom.c b/src/lindbergh/eeprom.c index 072632c..9b6f45a 100644 --- a/src/lindbergh/eeprom.c +++ b/src/lindbergh/eeprom.c @@ -6,7 +6,7 @@ #include "eeprom_settings.h" #include "config.h" -#define I2C_SMBUS_BLOCK_MAX 32 +#define I2C_SMBUS_BLOCK_MAX 32 #define I2C_GET_FUNCTIONS 0x705 #define I2C_SMBUS_TRANSFER 0x720 #define I2C_SET_SLAVE_MODE 0x703 @@ -15,17 +15,19 @@ #define I2C_SEEK 2 #define I2C_WRITE 3 -union i2c_smbus_data { - uint8_t byte; - uint16_t word; - uint8_t block[I2C_SMBUS_BLOCK_MAX + 2]; +union i2c_smbus_data +{ + uint8_t byte; + uint16_t word; + uint8_t block[I2C_SMBUS_BLOCK_MAX + 2]; }; -struct i2c_smbus_ioctl_data { - uint8_t read_write; - uint8_t command; - uint32_t size; - union i2c_smbus_data *data; +struct i2c_smbus_ioctl_data +{ + uint8_t read_write; + uint8_t command; + uint32_t size; + union i2c_smbus_data *data; }; FILE *eeprom = NULL; @@ -47,18 +49,34 @@ int initEeprom() eeprom = fopen(eepromPath, "rb+"); - if(eepromSettingsInit(eeprom) !=0) + if (eepromSettingsInit(eeprom) != 0) { printf("Error initializing eeprom settings."); fclose(eeprom); return 1; } - - if(getRegion() != getConfig()->region) - setRegion(eeprom, getConfig()->region); - - if(getFreeplay() != getConfig()->freeplay) - setFreeplay(eeprom, getConfig()->freeplay); + + if (getConfig()->region != -1) + { + if (getRegion() != getConfig()->region) + setRegion(eeprom, getConfig()->region); + } + + if (getConfig()->freeplay != -1) + { + if (getFreeplay() != getConfig()->freeplay) + setFreeplay(eeprom, getConfig()->freeplay); + } + + if ((getConfig()->game == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->game == THE_HOUSE_OF_THE_DEAD_EX) || (getConfig()->game == THE_HOUSE_OF_THE_DEAD_4_SPECIAL)) + { + if (fixCreditSection(eeprom) != 0) + { + printf("Error initializing eeprom settings."); + fclose(eeprom); + return 1; + } + } fseek(eeprom, 0, SEEK_SET); diff --git a/src/lindbergh/eeprom_settings.c b/src/lindbergh/eeprom_settings.c index faf6001..07aba1d 100644 --- a/src/lindbergh/eeprom_settings.c +++ b/src/lindbergh/eeprom_settings.c @@ -199,6 +199,19 @@ int setFreeplay(FILE *eeprom, int freeplay) return 0; } +int fixCreditSection(FILE *eeprom) +{ + eepromBuffer[eepromOffsetTable[CREDIT].offset + 36] = 0; + eepromBuffer[eepromOffsetTable[CREDIT].offset + 39] = 0; + addCRCtoBuffer(CREDIT); + if (writeSectiontoFile(eeprom, CREDIT) != 0) + { + printf("Error setting Free Play."); + return 1; + } + return 0; +} + int eepromSettingsInit( FILE *eeprom) { build_crc32_table(); diff --git a/src/lindbergh/eeprom_settings.h b/src/lindbergh/eeprom_settings.h index 39f7173..fde2f48 100644 --- a/src/lindbergh/eeprom_settings.h +++ b/src/lindbergh/eeprom_settings.h @@ -3,3 +3,4 @@ int getRegion(); int getFreeplay(); int setRegion(FILE *eeprom, int region); int setFreeplay(FILE *eeprom, int freeplay); +int fixCreditSection(FILE *eeprom); diff --git a/src/lindbergh/hook.c b/src/lindbergh/hook.c index 80eb031..fbe1ef0 100644 --- a/src/lindbergh/hook.c +++ b/src/lindbergh/hook.c @@ -42,7 +42,7 @@ #define OSRELEASE 1 #define PCI_CARD_1F0 2 - int hooks[5] = {-1, -1, -1, -1}; +int hooks[5] = {-1, -1, -1, -1}; FILE *fileHooks[3] = {NULL, NULL, NULL}; int fileRead[3] = {0, 0, 0}; char envpath[100]; diff --git a/src/lindbergh/jvs.c b/src/lindbergh/jvs.c index 655efde..8534b54 100644 --- a/src/lindbergh/jvs.c +++ b/src/lindbergh/jvs.c @@ -35,7 +35,7 @@ int initJVS() io.capabilities.players = 2; io.capabilities.analogueInBits = 8; io.capabilities.rightAlignBits = 0; - io.capabilities.analogueInChannels = 20; + io.capabilities.analogueInChannels = 8; io.capabilities.generalPurposeOutputs = 20; io.capabilities.commandVersion = 19; io.capabilities.jvsVersion = 48; @@ -265,8 +265,6 @@ JVSStatus processPacket() outputPacket.data[outputPacket.length] = REPORT_SUCCESS; outputPacket.data[outputPacket.length + 1] = io.state.inputSwitch[0]; outputPacket.length += 2; - - //printf("SW=%08d\r", io.state.inputSwitch[0]); for (int i = 0; i < inputPacket.data[index + 1]; i++) { @@ -569,8 +567,6 @@ JVSStatus readPacket(JVSPacket *packet) */ JVSStatus writePacket(JVSPacket *packet) { - - /* Get pointer to raw data in packet */ unsigned char *packetPointer = (unsigned char *)packet; diff --git a/src/lindbergh/patch.c b/src/lindbergh/patch.c index 25cae21..870b867 100644 --- a/src/lindbergh/patch.c +++ b/src/lindbergh/patch.c @@ -494,7 +494,7 @@ int initPatch() detourFunction(0x084e537d, amDongleUpdate); setVariable(0x080d1f02, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x080d1f06, 0xE8C3C990); // Patch acpSystem::checkDongle - setVariable(0x0807b76a, 0xc2839090); // Patch initializeArcadeBackup + setVariable(0x0807b76d, 0xc2839090); // Patch initializeArcadeBackup // Fixes detourFunction(0x084e500e, amDipswGetData); detourFunction(0x084e5086, stubRetZero); // Stub amDipswSetLed @@ -532,7 +532,8 @@ int initPatch() detourFunction(0x08510600, amDongleUpdate); setVariable(0x080dad63, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x080dad67, 0xE8C3C990); // Patch acpSystem::checkDongle - setVariable(0x0807e609, 0xc2839090); // Patch initializeArcadeBackup + setVariable(0x0807e609, 0x90909090); // Patch initializeArcadeBackup + setVariable(0x0807e60d, 0xc2839090); // Patch initializeArcadeBackup // Fixes detourFunction(0x08510256, amDipswGetData); detourFunction(0x085102ce, stubRetZero); // Stub amDipswSetLed @@ -648,6 +649,8 @@ int initPatch() break; case VIRTUA_TENNIS_3_TEST: { + // Debug + detourFunction(0x08054d14, _putConsole); // Crashes the game sometimes. // Security detourFunction(0x0815f610, amDongleInit); detourFunction(0x0815f923, amDongleIsAvailable);