Auto format

This commit is contained in:
sanni 2022-10-28 15:02:51 +02:00
parent 30d880bfa7
commit a8a981e137
10 changed files with 128 additions and 124 deletions

View File

@ -76,26 +76,61 @@ char ver[5] = "11.0";
//******************************************
// ENABLE MODULES
//******************************************
// remove // before #define to enable a module
#define enable_SNES
#define enable_SFM
#define enable_SV
#define enable_MD
#define enable_SMS
#define enable_N64
#define enable_GBX
#define enable_NES
// add/remove // before #define to disable/enable modules you
// don't need/need to save programm storage space and dynamic memory
// ColecoVision
#define enable_COLV
// Flashrom Programmer for SNES repros
#define enable_FLASH
#define enable_FLASH16
// #define enable_PCE
// #define enable_WS
// #define enable_NGP
// #define enable_INTV
// #define enable_COLV
// #define enable_VBOY
// #define enable_WSV
//#define enable_FLASH16
// Game Boy (Color) and Advance
#define enable_GBX
// Intellivision
#define enable_INTV
// Sega Mega Drive/Genesis
#define enable_MD
// Nintendo 64
#define enable_N64
// Nintendo Entertainment System/Family Computer
#define enable_NES
// Neo Geo Pocket
#define enable_NGP
// PC Engine/TurboGrafx 16
#define enable_PCE
// Benesse Pocket Challenge W
//#define enable_PCW
// Sega Master System
#define enable_SMS
// Super Nintendo
#define enable_SNES
// Super Famicom SF Memory Cassette
#define enable_SFM
// Super Famicom Satellaview
#define enable_SV
// Virtual Boy
#define enable_VBOY
// WonderSwan
//#define enable_WS
// Watara Supervision
//#define enable_WSV
//******************************************
// HW CONFIGS
//******************************************
@ -533,7 +568,8 @@ static const uint32_t crc_32_tab[] PROGMEM = { /* CRC polynomial 0xedb88320 */
// Defined as a macros, as compiler disregards inlining requests and these are
// performance-critical functions.
#define UPDATE_CRC(crc, ch) do { \
#define UPDATE_CRC(crc, ch) \
do { \
uint8_t idx = ((crc) ^ (ch)) & 0xff; \
uint32_t tab_value = pgm_read_dword(crc_32_tab + idx); \
(crc) = tab_value ^ ((crc) >> 8); \
@ -1900,10 +1936,7 @@ byte buildRomName(char *output, const byte *input, byte length) {
}
}
while (
output_len && (
output[output_len - 1] == '_' || output[output_len - 1] == ' '
)
) {
output_len && (output[output_len - 1] == '_' || output[output_len - 1] == ' ')) {
output_len--;
}
output[output_len] = 0;

View File

@ -903,9 +903,7 @@ void getCartInfo_GB() {
// Strip trailing white space
while (
myLength &&
(romName[myLength - 1] == '_' || romName[myLength - 1] == ' ')
) {
myLength && (romName[myLength - 1] == '_' || romName[myLength - 1] == ' ')) {
myLength--;
}
romName[myLength] = 0;
@ -918,34 +916,16 @@ void getCartInfo_GB() {
// MMM01 (Mani 4 in 1)
if (
(
strncmp(romName, "BOUKENJIMA2 SET", 15) == 0 && sdBuffer[0x14D] == 0
) || (
strncmp(romName, "BUBBLEBOBBLE SET", 16) == 0 && sdBuffer[0x14D] == 0xC6
) || (
strncmp(romName, "GANBARUGA SET", 13) == 0 && sdBuffer[0x14D] == 0x90
) || (
strncmp(romName, "RTYPE 2 SET", 11) == 0 && sdBuffer[0x14D] == 0x32
)
) {
strncmp(romName, "BOUKENJIMA2 SET", 15) == 0 && sdBuffer[0x14D] == 0)
|| (strncmp(romName, "BUBBLEBOBBLE SET", 16) == 0 && sdBuffer[0x14D] == 0xC6) || (strncmp(romName, "GANBARUGA SET", 13) == 0 && sdBuffer[0x14D] == 0x90) || (strncmp(romName, "RTYPE 2 SET", 11) == 0 && sdBuffer[0x14D] == 0x32)) {
romType = 0x0B;
}
// MBC1M
if (
(
strncmp(romName, "MOMOCOL", 7) == 0 && sdBuffer[0x14D] == 0x28
) || (
strncmp(romName, "BOMCOL", 6) == 0 && sdBuffer[0x14D] == 0x86
) || (
strncmp(romName, "GENCOL", 6) == 0 && sdBuffer[0x14D] == 0x8A
) || (
strncmp(romName, "SUPERCHINESE 123", 16) == 0 && sdBuffer[0x14D] == 0xE4
) || (
strncmp(romName, "MORTALKOMBATI&II", 16) == 0 && sdBuffer[0x14D] == 0xB9
) || (
strncmp(romName, "MORTALKOMBAT DUO", 16) == 0 && sdBuffer[0x14D] == 0xA7
)
) {
strncmp(romName, "MOMOCOL", 7) == 0 && sdBuffer[0x14D] == 0x28)
|| (strncmp(romName, "BOMCOL", 6) == 0 && sdBuffer[0x14D] == 0x86) || (strncmp(romName, "GENCOL", 6) == 0 && sdBuffer[0x14D] == 0x8A) || (strncmp(romName, "SUPERCHINESE 123", 16) == 0 && sdBuffer[0x14D] == 0xE4) || (strncmp(romName, "MORTALKOMBATI&II", 16) == 0 && sdBuffer[0x14D] == 0xB9) || (strncmp(romName, "MORTALKOMBAT DUO", 16) == 0 && sdBuffer[0x14D] == 0xA7)) {
romType += 0x100;
}

View File

@ -26,8 +26,7 @@ static const char gbSmartGameMenuItem4[] PROGMEM = "Switch Game";
//static const char gbSmartGameMenuItem5[] PROGMEM = "Reset"; (stored in common strings array)
static const char *const menuOptionsGBSmartGame[] PROGMEM = { gbSmartGameMenuItem1, gbSmartGameMenuItem2, gbSmartGameMenuItem3, gbSmartGameMenuItem4, string_reset2 };
struct GBSmartGameInfo
{
struct GBSmartGameInfo {
uint8_t start_bank;
uint8_t rom_type;
uint8_t rom_size;

View File

@ -673,10 +673,8 @@ byte copyToRomName_MD(char *output, const byte *input, byte length) {
for (byte i = 0; i < 48; i++) {
if (
(
(input[i] >= '0' && input[i] <= '9') ||
(input[i] >= 'A' && input[i] <= 'z')
) && myLength < length
) {
(input[i] >= '0' && input[i] <= '9') || (input[i] >= 'A' && input[i] <= 'z'))
&& myLength < length) {
output[myLength++] = input[i];
}
}

View File

@ -503,10 +503,7 @@ void setRomnameFromString(const char *input) {
break;
}
if (
(input[i] >= '0' && input[i] <= '9') ||
(input[i] >= 'A' && input[i] <= 'Z') ||
(input[i] >= 'a' && input[i] <= 'z')
) {
(input[i] >= '0' && input[i] <= '9') || (input[i] >= 'A' && input[i] <= 'Z') || (input[i] >= 'a' && input[i] <= 'z')) {
romName[myLength++] = input[i];
}
}
@ -568,10 +565,7 @@ void getMapping() {
readDatabaseEntry(database, &entry);
//if checksum search was successful set mapper and end search, also filter out 0xFF checksum
if (
entry.crc512 != 0xBD7BC39F && (
entry.crc512 == oldcrc32 || entry.crc512 == oldcrc32MMC3
)
) {
entry.crc512 != 0xBD7BC39F && (entry.crc512 == oldcrc32 || entry.crc512 == oldcrc32MMC3)) {
// Rewind to start of entry
rewind_line(database, 3);
break;