1
0
mirror of synced 2025-02-17 18:39:16 +01:00

Syntax error and fix for some games that do not support Freeplay.

This commit is contained in:
dkeruza 2023-12-18 00:32:09 -05:00
parent 711e27f489
commit 38f81fb887
8 changed files with 58 additions and 27 deletions

Binary file not shown.

View File

@ -430,8 +430,8 @@ int initConfig()
config.width = 1024; config.width = 1024;
config.height = 768; config.height = 768;
config.crc32 = elf_crc; config.crc32 = elf_crc;
config.region = US; config.region = -1;
config.freeplay = 1; config.freeplay = -1;
if (detectGame(config.crc32) != 0) 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); 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);

View File

@ -6,7 +6,7 @@
#include "eeprom_settings.h" #include "eeprom_settings.h"
#include "config.h" #include "config.h"
#define I2C_SMBUS_BLOCK_MAX 32 #define I2C_SMBUS_BLOCK_MAX 32
#define I2C_GET_FUNCTIONS 0x705 #define I2C_GET_FUNCTIONS 0x705
#define I2C_SMBUS_TRANSFER 0x720 #define I2C_SMBUS_TRANSFER 0x720
#define I2C_SET_SLAVE_MODE 0x703 #define I2C_SET_SLAVE_MODE 0x703
@ -15,17 +15,19 @@
#define I2C_SEEK 2 #define I2C_SEEK 2
#define I2C_WRITE 3 #define I2C_WRITE 3
union i2c_smbus_data { union i2c_smbus_data
uint8_t byte; {
uint16_t word; uint8_t byte;
uint8_t block[I2C_SMBUS_BLOCK_MAX + 2]; uint16_t word;
uint8_t block[I2C_SMBUS_BLOCK_MAX + 2];
}; };
struct i2c_smbus_ioctl_data { struct i2c_smbus_ioctl_data
uint8_t read_write; {
uint8_t command; uint8_t read_write;
uint32_t size; uint8_t command;
union i2c_smbus_data *data; uint32_t size;
union i2c_smbus_data *data;
}; };
FILE *eeprom = NULL; FILE *eeprom = NULL;
@ -47,18 +49,34 @@ int initEeprom()
eeprom = fopen(eepromPath, "rb+"); eeprom = fopen(eepromPath, "rb+");
if(eepromSettingsInit(eeprom) !=0) if (eepromSettingsInit(eeprom) != 0)
{ {
printf("Error initializing eeprom settings."); printf("Error initializing eeprom settings.");
fclose(eeprom); fclose(eeprom);
return 1; return 1;
} }
if(getRegion() != getConfig()->region) if (getConfig()->region != -1)
setRegion(eeprom, getConfig()->region); {
if (getRegion() != getConfig()->region)
if(getFreeplay() != getConfig()->freeplay) setRegion(eeprom, getConfig()->region);
setFreeplay(eeprom, getConfig()->freeplay); }
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); fseek(eeprom, 0, SEEK_SET);

View File

@ -199,6 +199,19 @@ int setFreeplay(FILE *eeprom, int freeplay)
return 0; 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) int eepromSettingsInit( FILE *eeprom)
{ {
build_crc32_table(); build_crc32_table();

View File

@ -3,3 +3,4 @@ int getRegion();
int getFreeplay(); int getFreeplay();
int setRegion(FILE *eeprom, int region); int setRegion(FILE *eeprom, int region);
int setFreeplay(FILE *eeprom, int freeplay); int setFreeplay(FILE *eeprom, int freeplay);
int fixCreditSection(FILE *eeprom);

View File

@ -42,7 +42,7 @@
#define OSRELEASE 1 #define OSRELEASE 1
#define PCI_CARD_1F0 2 #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}; FILE *fileHooks[3] = {NULL, NULL, NULL};
int fileRead[3] = {0, 0, 0}; int fileRead[3] = {0, 0, 0};
char envpath[100]; char envpath[100];

View File

@ -35,7 +35,7 @@ int initJVS()
io.capabilities.players = 2; io.capabilities.players = 2;
io.capabilities.analogueInBits = 8; io.capabilities.analogueInBits = 8;
io.capabilities.rightAlignBits = 0; io.capabilities.rightAlignBits = 0;
io.capabilities.analogueInChannels = 20; io.capabilities.analogueInChannels = 8;
io.capabilities.generalPurposeOutputs = 20; io.capabilities.generalPurposeOutputs = 20;
io.capabilities.commandVersion = 19; io.capabilities.commandVersion = 19;
io.capabilities.jvsVersion = 48; io.capabilities.jvsVersion = 48;
@ -265,8 +265,6 @@ JVSStatus processPacket()
outputPacket.data[outputPacket.length] = REPORT_SUCCESS; outputPacket.data[outputPacket.length] = REPORT_SUCCESS;
outputPacket.data[outputPacket.length + 1] = io.state.inputSwitch[0]; outputPacket.data[outputPacket.length + 1] = io.state.inputSwitch[0];
outputPacket.length += 2; outputPacket.length += 2;
//printf("SW=%08d\r", io.state.inputSwitch[0]);
for (int i = 0; i < inputPacket.data[index + 1]; i++) for (int i = 0; i < inputPacket.data[index + 1]; i++)
{ {
@ -569,8 +567,6 @@ JVSStatus readPacket(JVSPacket *packet)
*/ */
JVSStatus writePacket(JVSPacket *packet) JVSStatus writePacket(JVSPacket *packet)
{ {
/* Get pointer to raw data in packet */ /* Get pointer to raw data in packet */
unsigned char *packetPointer = (unsigned char *)packet; unsigned char *packetPointer = (unsigned char *)packet;

View File

@ -494,7 +494,7 @@ int initPatch()
detourFunction(0x084e537d, amDongleUpdate); detourFunction(0x084e537d, amDongleUpdate);
setVariable(0x080d1f02, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x080d1f02, 0x90909090); // Patch acpSystem::checkDongle
setVariable(0x080d1f06, 0xE8C3C990); // Patch acpSystem::checkDongle setVariable(0x080d1f06, 0xE8C3C990); // Patch acpSystem::checkDongle
setVariable(0x0807b76a, 0xc2839090); // Patch initializeArcadeBackup setVariable(0x0807b76d, 0xc2839090); // Patch initializeArcadeBackup
// Fixes // Fixes
detourFunction(0x084e500e, amDipswGetData); detourFunction(0x084e500e, amDipswGetData);
detourFunction(0x084e5086, stubRetZero); // Stub amDipswSetLed detourFunction(0x084e5086, stubRetZero); // Stub amDipswSetLed
@ -532,7 +532,8 @@ int initPatch()
detourFunction(0x08510600, amDongleUpdate); detourFunction(0x08510600, amDongleUpdate);
setVariable(0x080dad63, 0x90909090); // Patch acpSystem::checkDongle setVariable(0x080dad63, 0x90909090); // Patch acpSystem::checkDongle
setVariable(0x080dad67, 0xE8C3C990); // 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 // Fixes
detourFunction(0x08510256, amDipswGetData); detourFunction(0x08510256, amDipswGetData);
detourFunction(0x085102ce, stubRetZero); // Stub amDipswSetLed detourFunction(0x085102ce, stubRetZero); // Stub amDipswSetLed
@ -648,6 +649,8 @@ int initPatch()
break; break;
case VIRTUA_TENNIS_3_TEST: case VIRTUA_TENNIS_3_TEST:
{ {
// Debug
detourFunction(0x08054d14, _putConsole); // Crashes the game sometimes.
// Security // Security
detourFunction(0x0815f610, amDongleInit); detourFunction(0x0815f610, amDongleInit);
detourFunction(0x0815f923, amDongleIsAvailable); detourFunction(0x0815f923, amDongleIsAvailable);