Skip to content

Commit

Permalink
[FDS] "Gall Force - Eternal Story (Japan).fds" is not compatible with…
Browse files Browse the repository at this point in the history
… autoswitch feature (#351).

The rom automatically pauses the game when the disc is ejected.
  • Loading branch information
punesemu committed Dec 4, 2023
1 parent 03f67ca commit 0876193
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/core/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ void emu_info_rom(void) {
}

ischanged(info.header.prgrom_size != info.mapper.prgrom_size);
log_info_box(uL("PRG 8k rom;%-4lu [ %08X %ld ]%s%s"),
log_info_box(uL("PRG 8k rom;%-4lu [ 0x%08X %ld ]%s%s"),
prgrom_banks(S8K),
info.crc32.prg,
info.mapper.prgrom_size,
Expand All @@ -1447,7 +1447,7 @@ void emu_info_rom(void) {
int chip = 0;

for (chip = 0; chip < prgrom.chips.amount; chip++) {
log_info_box(uL(" 8k chip %d;%-4lu [ %08X %ld ]"),
log_info_box(uL(" 8k chip %d;%-4lu [ 0x%08X %ld ]"),
chip, prgrom_chip_size(chip) / 0x2000,
emu_crc32((void *)prgrom_chip(chip), prgrom_chip_size(chip)),
prgrom_chip_size(chip));
Expand All @@ -1457,7 +1457,7 @@ void emu_info_rom(void) {

if (chrrom_size()) {
ischanged(info.header.chrrom_size != info.mapper.chrrom_size);
log_info_box(uL("CHR 4k vrom;%-4lu [ %08X %ld ]%s%s"),
log_info_box(uL("CHR 4k vrom;%-4lu [ 0x%08X %ld ]%s%s"),
chrrom_banks(S4K),
info.crc32.chr,
info.mapper.chrrom_size,
Expand All @@ -1469,7 +1469,7 @@ void emu_info_rom(void) {
int chip = 0;

for (chip = 0; chip < chrrom.chips.amount; chip++) {
log_info_box(uL(" 4k chip %d;%-4lu [ %08X %ld ]"),
log_info_box(uL(" 4k chip %d;%-4lu [ 0x%08X %ld ]"),
chip, chrrom_chip_size(chip) / 0x1000,
emu_crc32((void *)chrrom_chip(chip), chrrom_chip_size(chip)),
chrrom_chip_size(chip));
Expand All @@ -1479,9 +1479,9 @@ void emu_info_rom(void) {
}

if (miscrom.trainer.in_use) {
log_info_box(uL("trainer;yes [ %08X ]"), info.crc32.trainer);
log_info_box(uL("trainer;yes [ 0x%08X ]"), info.crc32.trainer);
} else if (miscrom_size()) {
log_info_box(uL("MISC chips;%-4lu [ %08X %ld ]%s"),
log_info_box(uL("MISC chips;%-4lu [ 0x%08X %ld ]%s"),
(long)miscrom.chips,
info.crc32.misc,
miscrom_size(),
Expand All @@ -1498,7 +1498,7 @@ void emu_info_rom(void) {
#undef ischanged
#undef ifchanged

log_info_box(uL("CRC32;%08X"), info.crc32.total);
log_info_box(uL("CRC32;0x%08X"), info.crc32.total);

log_info_box(uL("CPU/PPU alig.;PPU %d/%d, CPU %d/%d"),
ppu_alignment.ppu, (machine.ppu_divide - 1),
Expand Down
37 changes: 31 additions & 6 deletions src/core/fds.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "gui.h"
#include "patcher.h"
#include "conf.h"
#include "../../c++/crc/crc.h"

#define BIOSFILE "disksys.rom"
#define DIFFVERSION 1
Expand All @@ -50,9 +51,11 @@ typedef struct _fds_sinfo {
} block3;
struct _fds_side_file_block4 {
uint32_t position;
uint32_t crc32;
} block4;
} file[0xFF];
uint32_t counted_files;
uint32_t crc32prg;
} _fds_sinfo;
typedef struct _fds_diff_ele {
BYTE side;
Expand All @@ -62,6 +65,7 @@ typedef struct _fds_diff_ele {

void fds_to_image(void);
void fds_from_image(void);
void fds_control_autoinsert(_fds_sinfo *sinfo);
void fds_diff_file_name(uTCHAR *dst, size_t lenght);
void fds_image_sinfo(BYTE side, _fds_sinfo *sinfo);
void fds_image_memset(WORD *dst, WORD value, uint32_t lenght);
Expand Down Expand Up @@ -291,36 +295,44 @@ BYTE fds_load_bios(void) {
void fds_info(void) {
log_info_box_open(uL("sides;"));
if (fds.info.expcted_side != fds.info.total_sides) {
log_close_box(uL("expected %d, finded %d"), fds.info.expcted_side, fds.info.total_sides);
log_close_box(uL("expected %d, finded %d"), fds.info.expcted_side, fds.info.total_sides);
} else {
log_close_box(uL("%d"), fds.info.total_sides);
}
for (int side = 0; side < fds.info.total_sides; side++) {
_fds_sinfo sinfo = { 0 };

fds_image_sinfo(side, &sinfo);
log_info_box(uL("FDS side %d;vrt size %d, files %d"), side, fds.info.sides[side].size, sinfo.counted_files);
log_info_box(uL("FDS side %d;prg crc 0x%08X, vrt size %d, files %3d, counted %3d"), side,
sinfo.crc32prg,
fds.info.sides[side].size,
sinfo.block2.files,
sinfo.counted_files);
// controllo se disabilitare l'autoinsert
fds_control_autoinsert(&sinfo);
}
}
void fds_info_side(BYTE side) {
_fds_sinfo sinfo = { 0 };

fds_image_sinfo(side, &sinfo);
log_info(uL("FDS side %d;disk %d, side %X, name %3s, version %d"), side,
log_info(uL("FDS side %d;disk %d, side %X, name %3s, version %d, vsize %d, prg crc 0x%08X"), side,
sinfo.block1.dnumber,
sinfo.block1.snumber + 0x0A,
sinfo.block1.name,
sinfo.block1.gversion);
log_info_box(uL("vrt disk size;%d"), fds.info.sides[side].size);
sinfo.block1.gversion,
fds.info.sides[side].size,
sinfo.crc32prg);
log_info_box(uL("block 1;pos %5d"), sinfo.block1.position);
log_info_box(uL("block 2;pos %5d, files %d, counted %d"),
sinfo.block2.position,
sinfo.block2.files,
sinfo.counted_files);
for (uint32_t i = 0; i < sinfo.counted_files; i++) {
log_info_box(uL("file %d;name %8s, size %5d, 0x%04X (b3 : %5d) (b4 : %5d)"), i,
log_info_box(uL("file %d;name %8s, size %5d, crc 0x%08X, 0x%04X (b3 : %5d) (b4 : %5d)"), i,
sinfo.file[i].block3.name,
sinfo.file[i].block3.length,
sinfo.file[i].block4.crc32,
sinfo.file[i].block3.length,
sinfo.file[i].block3.position,
sinfo.file[i].block4.position);
Expand Down Expand Up @@ -698,6 +710,16 @@ void fds_from_image(void) {
uremove(diff);
}
}
void fds_control_autoinsert(_fds_sinfo *sinfo) {
// NB : il crc32prg da controllare deve essere sempre quello
// del disco dove non vengono scritti i dati di salvataggio

// Gall Force - Eternal Story (Japan).fds - disk 0 side A
if (!strncmp((char *)&sinfo->block1.name[0], "GAL", 3) && (sinfo->crc32prg == 0xC5D1EC5D)) {
fds.auto_insert.disabled = TRUE;
gui_overlay_info_append_msg_precompiled(39, NULL);
}
}
void fds_diff_file_name(uTCHAR *dst, size_t lenght) {
uTCHAR ext[10], basename[255], *last_dot = NULL;

Expand Down Expand Up @@ -793,9 +815,12 @@ void fds_image_sinfo(BYTE side, _fds_sinfo *sinfo) {
sizeof(sinfo->file[file].block3.name));
// type
sinfo->file[file].block3.type = src[position + 0x0F];
sinfo->crc32prg = emu_crc32_continue((void *)&src[position], blength * sizeof(WORD), sinfo->crc32prg);
break;
case 4:
sinfo->file[file].block4.position = size;
sinfo->file[file].block4.crc32 = emu_crc32((void *)&src[position + 1], flength * sizeof(WORD));
sinfo->crc32prg = emu_crc32_continue((void *)&src[position], blength * sizeof(WORD), sinfo->crc32prg);
sinfo->counted_files++;
break;
default:
Expand Down
25 changes: 21 additions & 4 deletions src/gui/designer/translations/en_EN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1157,10 +1157,6 @@
<source>Nes rom files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FDS image files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TAS movie files</source>
<translation type="unfinished"></translation>
Expand Down Expand Up @@ -1618,6 +1614,10 @@
<source>Detach &amp;Barcode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Floppy Disk image files</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>nesKeyboardStatusBar</name>
Expand Down Expand Up @@ -1850,6 +1850,11 @@
<extracomment>Do not translate the words contained between parentheses (example: [red] or [normal]) are tags that have a specific meaning and do not traslate %1 and %2</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto switch [red]disabled[normal], game not compatible</source>
<extracomment>Do not translate the words contained between parentheses (example: [red] or [normal]) are tags that have a specific meaning and do not traslate %1 and %2</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>recStatusBar</name>
Expand Down Expand Up @@ -2870,6 +2875,18 @@
<source>Arabic</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Write mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Write to a separate file (Default)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Write to the original FDS/QD file</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>wdgSettingsInput</name>
Expand Down
2 changes: 2 additions & 0 deletions src/gui/wdgOverlayUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ static const char *info_messages_precompiled[] = {
/* 37 */ QT_TRANSLATE_NOOP("overlayWidgetInfo", "keyboard input released"),
//: Do not translate the words contained between parentheses (example: [red] or [normal]) are tags that have a specific meaning and do not traslate %1 and %2
/* 38 */ QT_TRANSLATE_NOOP("overlayWidgetInfo", "[red]error[normal] on write save state"),
//: Do not translate the words contained between parentheses (example: [red] or [normal]) are tags that have a specific meaning and do not traslate %1 and %2
/* 39 */ QT_TRANSLATE_NOOP("overlayWidgetInfo", "auto switch [red]disabled[normal], game not compatible"),
};

typedef struct _overlay_info_message {
Expand Down

0 comments on commit 0876193

Please sign in to comment.