From fe09dd504de1c3becc361c4765e9a1b58fffc3c0 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Sat, 29 Feb 2020 21:11:21 +0100 Subject: [PATCH] New scaling code, plus minor fixes. --- source/loadrom.c | 2 +- source/memz80.c | 2 +- source/scalers/scaler.c | 2 ++ source/sms.h | 2 +- source/system.h | 2 +- source/vdp.c | 4 +++- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/loadrom.c b/source/loadrom.c index 71cf85b..cf53861 100644 --- a/source/loadrom.c +++ b/source/loadrom.c @@ -445,7 +445,7 @@ uint32_t load_rom (char *filename) /* Seek to end of file, and get size */ fseek(fd, 0, SEEK_END); - cart.size = ftell(fd); + cart.size = (uint32_t)ftell(fd); fseek(fd, 0, SEEK_SET); if (cart.size < 0x4000) cart.size = 0x4000; diff --git a/source/memz80.c b/source/memz80.c index 5b2c836..acecfbf 100644 --- a/source/memz80.c +++ b/source/memz80.c @@ -46,7 +46,7 @@ uint8_t z80_read_unmapped(void) } /* Port $3E (Memory Control Port) */ -void memctrl_w(uint8_t data) +static void memctrl_w (uint8_t data) { /* detect CARTRIDGE/BIOS enabled/disabled */ if (IS_SMS) diff --git a/source/scalers/scaler.c b/source/scalers/scaler.c index 8c30235..99b4952 100644 --- a/source/scalers/scaler.c +++ b/source/scalers/scaler.c @@ -11,6 +11,8 @@ #define GMASK 0b0000011111100000 #define BMASK 0b0000000000011111 +/* upscale_160x144_to_212x144 and upscale_160x144_to_212x160 by rowsnug95 */ + void upscale_160x144_to_212x144(uint16_t* restrict src, uint16_t* restrict dst) { uint16_t* __restrict__ buffer_mem; diff --git a/source/sms.h b/source/sms.h index e4271cd..1b14dd3 100644 --- a/source/sms.h +++ b/source/sms.h @@ -116,10 +116,10 @@ typedef struct uint8_t memctrl; uint8_t ioctrl; uint8_t irq; - uint8_t device[2]; uint8_t gun_offset; uint32_t fm_detect; int32_t use_fm; + uint8_t device[2]; } sms_t; /* BIOS ROM */ diff --git a/source/system.h b/source/system.h index 4f42b5c..b081298 100644 --- a/source/system.h +++ b/source/system.h @@ -54,8 +54,8 @@ enum /* User input structure */ typedef struct { - uint8_t pad[2]; int32_t analog[2][2]; + uint8_t pad[2]; uint8_t system; } input_t; diff --git a/source/vdp.c b/source/vdp.c index 081fe64..1ad0462 100644 --- a/source/vdp.c +++ b/source/vdp.c @@ -47,6 +47,8 @@ bg_name_dirty[name] |= (1 << ((addr >> 2) & 7));\ } +/*** Vertical Counter Tables ***/ +extern uint8_t *vc_table[2][3]; /* VDP context */ vdp_t vdp; @@ -212,7 +214,7 @@ void viewport_check(void) } -void vdp_reg_w(uint8_t r, uint8_t d) +static void vdp_reg_w(uint8_t r, uint8_t d) { /* Store register data */ vdp.reg[r] = d;