Skip to content

Commit 8e63cd1

Browse files
committed
Fix C89 mixed declarations in gpu.c state save/load
Move uint8_t active_bank declarations to function scope in GPUStateSave and GPUStateLoad to satisfy C89/MSVC. Made-with: Cursor
1 parent ce3187b commit 8e63cd1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/gpu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,7 @@ INLINE static void gpu_opcode_sh(void)
17001700
size_t GPUStateSave(uint8_t *buf)
17011701
{
17021702
uint8_t *start = buf;
1703+
uint8_t active_bank;
17031704

17041705
STATE_SAVE_BUF(buf, gpu_ram_8, sizeof(gpu_ram_8));
17051706
STATE_SAVE_VAR(buf, gpu_pc);
@@ -1719,7 +1720,7 @@ size_t GPUStateSave(uint8_t *buf)
17191720
STATE_SAVE_BUF(buf, gpu_reg_bank_1, sizeof(gpu_reg_bank_1));
17201721

17211722
/* Save which register bank is active (0 or 1) */
1722-
uint8_t active_bank = (gpu_reg == gpu_reg_bank_0) ? 0 : 1;
1723+
active_bank = (gpu_reg == gpu_reg_bank_0) ? 0 : 1;
17231724
STATE_SAVE_VAR(buf, active_bank);
17241725

17251726
STATE_SAVE_VAR(buf, gpu_instruction);
@@ -1735,6 +1736,7 @@ size_t GPUStateSave(uint8_t *buf)
17351736
size_t GPUStateLoad(const uint8_t *buf)
17361737
{
17371738
const uint8_t *start = buf;
1739+
uint8_t active_bank;
17381740

17391741
STATE_LOAD_BUF(buf, gpu_ram_8, sizeof(gpu_ram_8));
17401742
STATE_LOAD_VAR(buf, gpu_pc);
@@ -1754,7 +1756,6 @@ size_t GPUStateLoad(const uint8_t *buf)
17541756
STATE_LOAD_BUF(buf, gpu_reg_bank_1, sizeof(gpu_reg_bank_1));
17551757

17561758
/* Restore register bank pointers */
1757-
uint8_t active_bank;
17581759
STATE_LOAD_VAR(buf, active_bank);
17591760
if (active_bank == 0)
17601761
{

0 commit comments

Comments
 (0)