From f821bb701128367a4b0ca80a874fc6c6d18c1314 Mon Sep 17 00:00:00 2001 From: kub Date: Fri, 1 Jan 2021 12:43:49 +0100 Subject: [PATCH] core, structural cleanup, fixes and improvements for type issues #2 --- Makefile | 2 +- Makefile.libretro | 2 +- cpu/DrZ80/drz80.S | 2 +- cpu/debug.c | 2 +- cpu/fame/famec.c | 3 +++ cpu/sh2/compiler.c | 4 ++-- cpu/sh2/mame/sh2pico.c | 12 +++++------ cpu/sh2/sh2.h | 4 ++-- pico/32x/32x.c | 2 +- pico/32x/draw.c | 20 +++++++++---------- pico/32x/draw_arm.S | 4 ++-- pico/32x/memory.c | 2 +- pico/32x/memory_arm.S | 2 +- pico/32x/sh2soc.c | 18 ++++++++--------- pico/cart.c | 4 ++-- pico/carthw/svp/compiler.c | 6 +++--- pico/carthw/svp/memory.c | 4 ++-- pico/carthw/svp/ssp16.c | 2 +- pico/carthw/svp/stub_arm.S | 2 +- pico/cd/genplus_macros.h | 12 +++++------ pico/cd/gfx.c | 2 +- pico/cd/gfx_dma.c | 2 +- pico/cd/memory_arm.S | 4 ++-- pico/debugCPU.c | 1 - pico/draw.c | 6 +++--- pico/pico/memory.c | 1 - pico/pico_int.h | 17 ++++++++-------- pico/sek.c | 2 +- pico/sound/mix.c | 2 +- pico/sound/ym2612.h | 16 +++++++-------- pico/sound/ym2612_arm.S | 2 +- pico/state.c | 2 +- pico/videoport.c | 2 +- platform/common/main.c | 13 ++++++------ platform/common/menu_pico.c | 8 ++++---- platform/common/plat_sdl.c | 2 +- platform/gizmondo/emu.c | 2 +- platform/gizmondo/giz.c | 2 +- platform/gizmondo/main.c | 2 +- platform/gizmondo/menu.c | 12 +++++------ platform/gp2x/940ctl.c | 6 +++--- platform/gp2x/code940/940.c | 2 +- platform/gp2x/code940/940shared.h | 2 +- platform/gp2x/code940/Makefile | 5 +---- platform/gp2x/code940/mp3test.c | 2 +- platform/libretro/libretro.c | 5 +++-- platform/{ => libretro}/ps2/Draw_mips_r5900.s | 0 .../{ => libretro}/ps2/Memory_mips_r5900.s | 0 platform/{ => libretro}/ps2/asm.h | 0 platform/{ => libretro}/ps2/asm.s | 0 platform/{ => libretro}/switch/mman.h | 0 platform/linux/emu.c | 6 +++--- platform/linux/io.c | 2 +- platform/psp/emu.c | 1 - platform/psp/main.c | 2 +- platform/psp/menu.c | 5 +---- platform/psp/mp3.c | 6 +++--- platform/psp/psp.c | 4 ++-- platform/win32/main.c | 5 ++--- platform/win32/plat.c | 5 ++--- tools/bin_to_cso_mp3/bin_to_cso_mp3.c | 17 ++++++++-------- tools/drctest.c | 2 +- tools/mkoffsets.c | 2 +- tools/mkoffsets.sh | 2 +- 64 files changed, 140 insertions(+), 150 deletions(-) rename platform/{ => libretro}/ps2/Draw_mips_r5900.s (100%) rename platform/{ => libretro}/ps2/Memory_mips_r5900.s (100%) rename platform/{ => libretro}/ps2/asm.h (100%) rename platform/{ => libretro}/ps2/asm.s (100%) rename platform/{ => libretro}/switch/mman.h (100%) diff --git a/Makefile b/Makefile index b38b3012..673292b4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ $(LD) ?= $(CC) TARGET ?= PicoDrive DEBUG ?= 0 -CFLAGS += -I. +CFLAGS += -I$(PWD) CYCLONE_CC ?= gcc CYCLONE_CXX ?= g++ diff --git a/Makefile.libretro b/Makefile.libretro index 67775769..444cf792 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -205,7 +205,7 @@ else ifeq ($(platform), ps2) ARCH = mipsel asm_render = 1 - OBJS += platform/ps2/asm.o + OBJS += platform/libretro/ps2/asm.o # CTR (3DS) else ifeq ($(platform), ctr) diff --git a/cpu/DrZ80/drz80.S b/cpu/DrZ80/drz80.S index 4d592b16..3fdbc9a7 100644 --- a/cpu/DrZ80/drz80.S +++ b/cpu/DrZ80/drz80.S @@ -5,7 +5,7 @@ ;@ For commercial use, separate licencing terms must be obtained. -#include "../../pico/arm_features.h" +#include .data .align 4 diff --git a/cpu/debug.c b/cpu/debug.c index a464413b..a1d7e117 100644 --- a/cpu/debug.c +++ b/cpu/debug.c @@ -8,7 +8,7 @@ #define _GNU_SOURCE #include -#include "../pico/pico_int.h" +#include #include "debug.h" static char pdb_pending_cmds[128]; diff --git a/cpu/fame/famec.c b/cpu/fame/famec.c index 60a9e550..f246b559 100644 --- a/cpu/fame/famec.c +++ b/cpu/fame/famec.c @@ -60,6 +60,8 @@ #define FAMEC_EXTRA_INLINE INLINE #endif +#include +/* #ifdef u8 #undef u8 #endif @@ -95,6 +97,7 @@ #define u32 unsigned int #define s32 signed int #define uptr uintptr_t +*/ /* typedef unsigned char u8; diff --git a/cpu/sh2/compiler.c b/cpu/sh2/compiler.c index 38e91223..c5c9c93f 100644 --- a/cpu/sh2/compiler.c +++ b/cpu/sh2/compiler.c @@ -32,8 +32,8 @@ #include #include -#include "../../pico/pico_int.h" -#include "../../pico/arm_features.h" +#include +#include #include "sh2.h" #include "compiler.h" #include "../drc/cmn.h" diff --git a/cpu/sh2/mame/sh2pico.c b/cpu/sh2/mame/sh2pico.c index 467b2adc..380ca24f 100644 --- a/cpu/sh2/mame/sh2pico.c +++ b/cpu/sh2/mame/sh2pico.c @@ -9,12 +9,12 @@ // MAME types #ifndef INT8 -typedef signed char INT8; -typedef signed short INT16; -typedef signed int INT32; -typedef unsigned int UINT32; -typedef unsigned short UINT16; -typedef unsigned char UINT8; +typedef s8 INT8; +typedef s16 INT16; +typedef s32 INT32; +typedef u32 UINT32; +typedef u16 UINT16; +typedef u8 UINT8; #endif #ifdef DRC_SH2 diff --git a/cpu/sh2/sh2.h b/cpu/sh2/sh2.h index 1c777f8a..c3ca1146 100644 --- a/cpu/sh2/sh2.h +++ b/cpu/sh2/sh2.h @@ -1,8 +1,8 @@ #ifndef __SH2_H__ #define __SH2_H__ -#include "../../pico/pico_types.h" -#include "../../pico/pico_port.h" +#include +#include // registers - matches structure order typedef enum { diff --git a/pico/32x/32x.c b/pico/32x/32x.c index 3b889648..f19dbd58 100644 --- a/pico/32x/32x.c +++ b/pico/32x/32x.c @@ -7,7 +7,7 @@ */ #include "../pico_int.h" #include "../sound/ym2612.h" -#include "../../cpu/sh2/compiler.h" +#include struct Pico32x Pico32x; SH2 sh2s[2]; diff --git a/pico/32x/draw.c b/pico/32x/draw.c index c38f60d6..6954eca9 100644 --- a/pico/32x/draw.c +++ b/pico/32x/draw.c @@ -26,19 +26,19 @@ int DrawLineDestIncrement32x; static void convert_pal555(int invert_prio) { - unsigned int *ps = (void *)Pico32xMem->pal; - unsigned int *pd = (void *)Pico32xMem->pal_native; - unsigned int m1 = 0x001f001f; - unsigned int m2 = 0x03e003e0; - unsigned int m3 = 0xfc00fc00; // includes prio bit - unsigned int inv = 0; + u32 *ps = (void *)Pico32xMem->pal; + u32 *pd = (void *)Pico32xMem->pal_native; + u32 m1 = 0x001f001f; + u32 m2 = 0x03e003e0; + u32 m3 = 0xfc00fc00; // includes prio bit + u32 inv = 0; int i; if (invert_prio) inv = 0x80008000; for (i = 0x100/2; i > 0; i--, ps++, pd++) { - unsigned int t = *ps ^ inv; + u32 t = *ps ^ inv; *pd = PXCONV(t); } @@ -48,9 +48,9 @@ static void convert_pal555(int invert_prio) // direct color mode #define do_line_dc(pd, p32x, pmd, inv, pmd_draw_code) \ { \ - const unsigned int m1 = 0x001f; \ - const unsigned int m2 = 0x03e0; \ - const unsigned int m3 = 0x7c00; \ + const u16 m1 = 0x001f; \ + const u16 m2 = 0x03e0; \ + const u16 m3 = 0x7c00; \ unsigned short t; \ int i = 320; \ \ diff --git a/pico/32x/draw_arm.S b/pico/32x/draw_arm.S index ad5d428b..bf26f746 100644 --- a/pico/32x/draw_arm.S +++ b/pico/32x/draw_arm.S @@ -7,8 +7,8 @@ @* See COPYING file in the top-level directory. @* -#include "pico/arm_features.h" -#include "pico/pico_int_offs.h" +#include +#include .extern Pico32x .extern Pico diff --git a/pico/32x/memory.c b/pico/32x/memory.c index 4abc1802..931e432e 100644 --- a/pico/32x/memory.c +++ b/pico/32x/memory.c @@ -42,7 +42,7 @@ #include "../pico_int.h" #include "../memory.h" -#include "../../cpu/sh2/compiler.h" +#include DRC_DECLARE_SR; static const char str_mars[] = "MARS"; diff --git a/pico/32x/memory_arm.S b/pico/32x/memory_arm.S index 40707fe7..642e13ca 100644 --- a/pico/32x/memory_arm.S +++ b/pico/32x/memory_arm.S @@ -6,7 +6,7 @@ * See COPYING file in the top-level directory. */ -#include "../pico_int_offs.h" +#include @ 32X bank sizes... TODO this should somehow come from an include file .equ SH2_ROM_SHIFT, 10 @ 0x003fffff diff --git a/pico/32x/sh2soc.c b/pico/32x/sh2soc.c index 9da3f296..a355f759 100644 --- a/pico/32x/sh2soc.c +++ b/pico/32x/sh2soc.c @@ -25,14 +25,14 @@ #include "../pico_int.h" #include "../memory.h" -#include "../../cpu/sh2/compiler.h" +#include DRC_DECLARE_SR; // DMAC handling struct dma_chan { - unsigned int sar, dar; // src, dst addr - unsigned int tcr; // transfer count - unsigned int chcr; // chan ctl + u32 sar, dar; // src, dst addr + u32 tcr; // transfer count + u32 chcr; // chan ctl // -- dm dm sm sm ts ts ar am al ds dl tb ta ie te de // ts - transfer size: 1, 2, 4, 16 bytes // ar - auto request if 1, else dreq signal @@ -47,11 +47,11 @@ struct dma_chan { struct dmac { struct dma_chan chan[2]; - unsigned int vcrdma0; - unsigned int unknown0; - unsigned int vcrdma1; - unsigned int unknown1; - unsigned int dmaor; + u32 vcrdma0; + u32 unknown0; + u32 vcrdma1; + u32 unknown1; + u32 dmaor; // -- pr ae nmif dme // pr - priority: chan0 > chan1 or round-robin // ae - address error diff --git a/pico/cart.c b/pico/cart.c index 8d3a1bc2..17350046 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -8,8 +8,8 @@ */ #include "pico_int.h" -#include "../cpu/debug.h" -#include "../unzip/unzip.h" +#include +#include #include #ifdef USE_LIBRETRO_VFS diff --git a/pico/carthw/svp/compiler.c b/pico/carthw/svp/compiler.c index 65d1a194..f83c29ce 100644 --- a/pico/carthw/svp/compiler.c +++ b/pico/carthw/svp/compiler.c @@ -6,8 +6,8 @@ * See COPYING file in the top-level directory. */ -#include "../../pico_int.h" -#include "../../../cpu/drc/cmn.h" +#include +#include #include "compiler.h" // FIXME: asm has these hardcoded @@ -39,7 +39,7 @@ void ssp_drc_end(void){} #endif #define COUNT_OP -#include "../../../cpu/drc/emit_arm.c" +#include // ----------------------------------------------------- diff --git a/pico/carthw/svp/memory.c b/pico/carthw/svp/memory.c index c7216112..6fb3c3ed 100644 --- a/pico/carthw/svp/memory.c +++ b/pico/carthw/svp/memory.c @@ -26,8 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "../../pico_int.h" -#include "../../memory.h" +#include +#include // for wait loop det static void PicoWrite16_dram(u32 a, u32 d) diff --git a/pico/carthw/svp/ssp16.c b/pico/carthw/svp/ssp16.c index 2fb40015..229449fb 100644 --- a/pico/carthw/svp/ssp16.c +++ b/pico/carthw/svp/ssp16.c @@ -206,7 +206,7 @@ * ops not used by VR are not implemented */ -#include "../../pico_int.h" +#include #define u32 unsigned int diff --git a/pico/carthw/svp/stub_arm.S b/pico/carthw/svp/stub_arm.S index 736d459b..cb1c1cd5 100644 --- a/pico/carthw/svp/stub_arm.S +++ b/pico/carthw/svp/stub_arm.S @@ -6,7 +6,7 @@ @* See COPYING file in the top-level directory. @* -#include "../../arm_features.h" +#include @.syntax unified .text diff --git a/pico/cd/genplus_macros.h b/pico/cd/genplus_macros.h index 8ac5d35b..85da416b 100644 --- a/pico/cd/genplus_macros.h +++ b/pico/cd/genplus_macros.h @@ -5,12 +5,12 @@ #undef int16 #undef int32 -#define uint8 unsigned char -#define uint16 unsigned short -#define uint32 unsigned int -#define int8 signed char -#define int16 signed short -#define int32 signed int +#define uint8 u8 +#define uint16 u16 +#define uint32 u32 +#define int8 s8 +#define int16 s16 +#define int32 s32 #define READ_BYTE(BASE, ADDR) (BASE)[(ADDR)^1] #define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[(ADDR)^1] = (VAL) diff --git a/pico/cd/gfx.c b/pico/cd/gfx.c index e3434e11..b7d9cf1c 100644 --- a/pico/cd/gfx.c +++ b/pico/cd/gfx.c @@ -311,7 +311,7 @@ static void gfx_render(uint32 bufferIndex, uint32 width) } } -void gfx_start(unsigned int base) +void gfx_start(uint32 base) { /* make sure 2M mode is enabled */ if (!(Pico_mcd->s68k_regs[3] & 0x04)) diff --git a/pico/cd/gfx_dma.c b/pico/cd/gfx_dma.c index 76777d22..b1096103 100644 --- a/pico/cd/gfx_dma.c +++ b/pico/cd/gfx_dma.c @@ -14,7 +14,7 @@ PICO_INTERNAL void DmaSlowCell(u32 source, u32 a, int len, unsigned char inc) { unsigned char *base; - unsigned int asrc, a2; + u32 asrc, a2; u16 *r; base = Pico_mcd->word_ram1M[Pico_mcd->s68k_regs[3]&1]; diff --git a/pico/cd/memory_arm.S b/pico/cd/memory_arm.S index 0d1369ee..d3c2bb8c 100644 --- a/pico/cd/memory_arm.S +++ b/pico/cd/memory_arm.S @@ -6,8 +6,8 @@ @* See COPYING file in the top-level directory. @* -#include "../arm_features.h" -#include "../pico_int_offs.h" +#include +#include .equiv PCM_STEP_SHIFT, 11 diff --git a/pico/debugCPU.c b/pico/debugCPU.c index 128f4144..caf75f2e 100644 --- a/pico/debugCPU.c +++ b/pico/debugCPU.c @@ -8,7 +8,6 @@ #include "pico_int.h" -typedef unsigned char u8; static unsigned int pppc, ops=0; extern unsigned int lastread_a, lastread_d[16], lastwrite_cyc_d[16], lastwrite_mus_d[16]; diff --git a/pico/draw.c b/pico/draw.c index 27a48a87..8aa39dea 100644 --- a/pico/draw.c +++ b/pico/draw.c @@ -53,7 +53,7 @@ static unsigned char DefHighCol[8+320+8]; unsigned char *HighColBase = DefHighCol; int HighColIncrement; -static u16 DefOutBuff[320*2]; +static u16 DefOutBuff[320*2] ALIGNED(4); void *DrawLineDestBase = DefOutBuff; int DrawLineDestIncrement; @@ -200,7 +200,7 @@ TileFlipMaker(TileFlipNonSH, pix_nonsh) // draw sprite pixels, process operator colors #define pix_sh(x) \ if (likely(t)) \ - pd[x]=(likely(t<0xe) ? pal|t : pd[x]|((t-1)<<6)); + pd[x]=(likely(t<0xe) ? pal|t : pd[x]|((t-1)<<6)) TileNormMaker(TileNormSH, pix_sh) TileFlipMaker(TileFlipSH, pix_sh) @@ -208,7 +208,7 @@ TileFlipMaker(TileFlipSH, pix_sh) // draw sprite pixels, mark but don't process operator colors #define pix_sh_markop(x) \ if (likely(t)) \ - pd[x]=(likely(t<0xe) ? pal|t : pd[x]|0x40); + pd[x]=(likely(t<0xe) ? pal|t : pd[x]|0x40) TileNormMaker(TileNormSH_markop, pix_sh_markop) TileFlipMaker(TileFlipSH_markop, pix_sh_markop) diff --git a/pico/pico/memory.c b/pico/pico/memory.c index ae262076..14bf5d43 100644 --- a/pico/pico/memory.c +++ b/pico/pico/memory.c @@ -7,7 +7,6 @@ */ #include "../pico_int.h" #include "../memory.h" -#include "../sound/sn76496.h" /* void dump(u16 w) diff --git a/pico/pico_int.h b/pico/pico_int.h index b4b9a85a..ce20d1ee 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -11,6 +11,7 @@ #define PICO_INTERNAL_INCLUDED #include #include +#include "pico_types.h" #include "pico_port.h" #include "pico.h" #include "carthw/carthw.h" @@ -31,11 +32,9 @@ extern "C" { #endif -#include "pico_types.h" - // ----------------------- 68000 CPU ----------------------- #ifdef EMU_C68K -#include "../cpu/cyclone/Cyclone.h" +#include extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k; #define SekCyclesLeft PicoCpuCM68k.cycles // cycles left for this run #define SekCyclesLeftS68k PicoCpuCS68k.cycles @@ -60,7 +59,7 @@ extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k; #endif #ifdef EMU_F68K -#include "../cpu/fame/fame.h" +#include extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k; #define SekCyclesLeft PicoCpuFM68k.io_cycle_counter #define SekCyclesLeftS68k PicoCpuFS68k.io_cycle_counter @@ -91,7 +90,7 @@ extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k; #endif #ifdef EMU_M68K -#include "../cpu/musashi/m68kcpu.h" +#include extern m68ki_cpu_core PicoCpuMM68k, PicoCpuMS68k; #ifndef SekCyclesLeft #define SekCyclesLeft PicoCpuMM68k.cyc_remaining_cycles @@ -160,7 +159,7 @@ extern unsigned int SekCycleAimS68k; // ----------------------- Z80 CPU ----------------------- #if defined(_USE_DRZ80) -#include "../cpu/DrZ80/drz80.h" +#include extern struct DrZ80 drZ80; @@ -175,7 +174,7 @@ extern struct DrZ80 drZ80; #define z80_pc() (drZ80.Z80PC - drZ80.Z80PC_BASE) #elif defined(_USE_CZ80) -#include "../cpu/cz80/cz80.h" +#include #define z80_run(cycles) Cz80_Exec(&CZ80, cycles) #define z80_run_nr(cycles) Cz80_Exec(&CZ80, cycles) @@ -209,7 +208,7 @@ extern struct DrZ80 drZ80; // ----------------------- SH2 CPU ----------------------- -#include "cpu/sh2/sh2.h" +#include extern SH2 sh2s[2]; #define msh2 sh2s[0] @@ -721,7 +720,7 @@ int load_cd_image(const char *cd_img_name, int *type); // cd/gfx.c void gfx_init(void); -void gfx_start(unsigned int base); +void gfx_start(u32 base); void gfx_update(unsigned int cycles); int gfx_context_save(unsigned char *state); int gfx_context_load(const unsigned char *state); diff --git a/pico/sek.c b/pico/sek.c index 9be7f9a5..6c340672 100644 --- a/pico/sek.c +++ b/pico/sek.c @@ -270,7 +270,7 @@ PICO_INTERNAL void SekUnpackCpu(const unsigned char *cpu, int is_sub) /* idle loop detection, not to be used in CD mode */ #ifdef EMU_C68K -#include "cpu/cyclone/tools/idle.h" +#include #endif static unsigned short **idledet_ptrs = NULL; diff --git a/pico/sound/mix.c b/pico/sound/mix.c index 58e9c8c7..099b8c97 100644 --- a/pico/sound/mix.c +++ b/pico/sound/mix.c @@ -7,7 +7,7 @@ * See COPYING file in the top-level directory. */ -#include "string.h" +#include #define MAXOUT (+32767) #define MINOUT (-32768) diff --git a/pico/sound/ym2612.h b/pico/sound/ym2612.h index 9b4fd720..7d16efbf 100644 --- a/pico/sound/ym2612.h +++ b/pico/sound/ym2612.h @@ -6,16 +6,16 @@ #define _H_FM_FM_ /* compiler dependence */ -#include +#include "../pico_types.h" #ifndef UINT8 -typedef uint8_t UINT8; /* unsigned 8bit */ -typedef uint16_t UINT16; /* unsigned 16bit */ -typedef uint32_t UINT32; /* unsigned 32bit */ +typedef u8 UINT8; /* unsigned 8bit */ +typedef u16 UINT16; /* unsigned 16bit */ +typedef u32 UINT32; /* unsigned 32bit */ #endif #ifndef INT8 -typedef int8_t INT8; /* signed 8bit */ -typedef int16_t INT16; /* signed 16bit */ -typedef int32_t INT32; /* signed 32bit */ +typedef s8 INT8; /* signed 8bit */ +typedef s16 INT16; /* signed 16bit */ +typedef s32 INT32; /* signed 32bit */ #endif #if 1 @@ -183,7 +183,7 @@ int YM2612PicoStateLoad2(int *tat, int *tbt); #define YM2612PicoStateLoad YM2612PicoStateLoad_ #else /* GP2X specific */ -#include "../../platform/gp2x/940ctl.h" +#include #define YM2612Init(baseclock,rate,ssg) do { \ if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, ssg); \ else YM2612Init_(baseclock, rate, ssg); \ diff --git a/pico/sound/ym2612_arm.S b/pico/sound/ym2612_arm.S index 0334d1cf..bdac3887 100644 --- a/pico/sound/ym2612_arm.S +++ b/pico/sound/ym2612_arm.S @@ -13,7 +13,7 @@ @ vim:filetype=armasm -#include "../arm_features.h" +#include @ very simple YM2612 output rate to sample rate adaption (~500k cycles @44100) #define INTERPOL diff --git a/pico/state.c b/pico/state.c index d56bd50a..6e3596fc 100644 --- a/pico/state.c +++ b/pico/state.c @@ -9,7 +9,7 @@ #include "pico_int.h" #include -#include "../cpu/sh2/sh2.h" +#include #include "sound/ym2612.h" #include "sound/emu2413/emu2413.h" #include "state.h" diff --git a/pico/videoport.c b/pico/videoport.c index 8e42e309..4c3a5d07 100644 --- a/pico/videoport.c +++ b/pico/videoport.c @@ -22,7 +22,7 @@ static int blankline; // display disabled for this line u32 SATaddr, SATmask; // VRAM addr of sprite attribute table -int (*PicoDmaHook)(unsigned int source, int len, unsigned short **base, unsigned int *mask) = NULL; +int (*PicoDmaHook)(u32 source, int len, unsigned short **base, unsigned int *mask) = NULL; /* VDP FIFO implementation diff --git a/platform/common/main.c b/platform/common/main.c index a45c58d4..a7a8312c 100644 --- a/platform/common/main.c +++ b/platform/common/main.c @@ -96,10 +96,6 @@ int main(int argc, char *argv[]) emu_init(); -#ifdef GPERF - ProfilerStart("gperf.out"); -#endif - engineState = PGS_Menu; if (argc > 1) @@ -142,7 +138,13 @@ int main(int argc, char *argv[]) /* vvv fallthrough */ case PGS_Running: +#ifdef GPERF + ProfilerStart("gperf.out"); +#endif emu_loop(); +#ifdef GPERF + ProfilerStop(); +#endif break; case PGS_Quit: @@ -155,9 +157,6 @@ int main(int argc, char *argv[]) } endloop: -#ifdef GPERF - ProfilerStop(); -#endif emu_finish(); plat_finish(); diff --git a/platform/common/menu_pico.c b/platform/common/menu_pico.c index d4306634..46519540 100644 --- a/platform/common/menu_pico.c +++ b/platform/common/menu_pico.c @@ -55,15 +55,15 @@ static unsigned short fname2color(const char *fname) return 0xffff; } -#include "../libpicofe/menu.c" +#include static const char *men_dummy[] = { NULL }; /* platform specific options and handlers */ #if defined(__GP2X__) -#include "../gp2x/menu.c" +#include #elif defined(PANDORA) -#include "../pandora/menu.c" +#include #else #define MENU_OPTIONS_GFX #define MENU_OPTIONS_ADV @@ -84,7 +84,7 @@ static void make_bg(int no_scale) if (!no_scale && g_menuscreen_w / w >= 2 && g_menuscreen_h / h >= 2) { - unsigned int t, *d = g_menubg_ptr; + u32 t, *d = g_menubg_ptr; d += (g_menuscreen_h / 2 - h * 2 / 2) * g_menuscreen_w / 2; d += (g_menuscreen_w / 2 - w * 2 / 2) / 2; diff --git a/platform/common/plat_sdl.c b/platform/common/plat_sdl.c index ceab084c..75dda2c5 100644 --- a/platform/common/plat_sdl.c +++ b/platform/common/plat_sdl.c @@ -33,7 +33,7 @@ static struct in_pdata in_sdl_platform_data = { static int yuv_ry[32], yuv_gy[32], yuv_by[32]; static unsigned char yuv_u[32 * 2], yuv_v[32 * 2]; static unsigned char yuv_y[256]; -static struct uyvy { unsigned int y:8; unsigned int vyu:24; } yuv_uyvy[65536]; +static struct uyvy { uint32_t y:8; uint32_t vyu:24; } yuv_uyvy[65536]; void bgr_to_uyvy_init(void) { diff --git a/platform/gizmondo/emu.c b/platform/gizmondo/emu.c index c5478f4b..83f8cee1 100644 --- a/platform/gizmondo/emu.c +++ b/platform/gizmondo/emu.c @@ -8,9 +8,9 @@ #include "kgsdk/Framework2D.h" #include "kgsdk/FrameworkAudio.h" #include "../common/emu.h" -#include "../common/lprintf.h" #include "../common/arm_utils.h" #include "../common/config.h" +#include "../libpicofe/lprintf.h" #include "emu.h" #include "menu.h" #include "giz.h" diff --git a/platform/gizmondo/giz.c b/platform/gizmondo/giz.c index 90273888..93f2c341 100644 --- a/platform/gizmondo/giz.c +++ b/platform/gizmondo/giz.c @@ -11,7 +11,7 @@ #include "kgsdk/Framework.h" #include "kgsdk/Framework2D.h" #include "giz.h" -#include "version.h" +#include "../common/version.h" #define LOG_FILE "log.log" diff --git a/platform/gizmondo/main.c b/platform/gizmondo/main.c index 562b7ade..a53e901c 100644 --- a/platform/gizmondo/main.c +++ b/platform/gizmondo/main.c @@ -14,7 +14,7 @@ #include "../common/menu.h" #include "../common/emu.h" #include "../common/config.h" -#include "version.h" +#include "../common/version.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) diff --git a/platform/gizmondo/menu.c b/platform/gizmondo/menu.c index 47778be2..07a2ce7b 100644 --- a/platform/gizmondo/menu.c +++ b/platform/gizmondo/menu.c @@ -28,7 +28,7 @@ #include "../common/emu.h" #include "../common/readpng.h" #include "../common/input.h" -#include "version.h" +#include "../common/version.h" #include #include @@ -49,8 +49,6 @@ unsigned char *menu_screen = gfx_buffer; /* draw here and blit later, to avoid f void menu_darken_bg(void *dst, const void *src, int pixels, int darker); static void menu_prepare_bg(int use_game_bg); -static unsigned int inp_prev = 0; - void menu_draw_begin(int use_bgbuff) { if (use_bgbuff) @@ -1457,14 +1455,14 @@ static void menu_loop_root(void) // warning: alignment void menu_darken_bg(void *dst, const void *src, int pixels, int darker) { - unsigned int *dest = dst; - const unsigned int *srce = src; + u32 *dest = dst; + const u32 *srce = src; pixels /= 2; if (darker) { while (pixels--) { - unsigned int p = *srce++; + u32 p = *srce++; *dest++ = ((p&0xf79ef79e)>>1) - ((p&0xc618c618)>>3); } } @@ -1472,7 +1470,7 @@ void menu_darken_bg(void *dst, const void *src, int pixels, int darker) { while (pixels--) { - unsigned int p = *srce++; + u32 p = *srce++; *dest++ = (p&0xf79ef79e)>>1; } } diff --git a/platform/gp2x/940ctl.c b/platform/gp2x/940ctl.c index cd3fcdc3..b1730025 100644 --- a/platform/gp2x/940ctl.c +++ b/platform/gp2x/940ctl.c @@ -22,9 +22,9 @@ #include "../common/arm_utils.h" #include "../common/menu_pico.h" #include "../common/emu.h" -#include "../../pico/pico_int.h" -#include "../../pico/sound/ym2612.h" -#include "../../pico/sound/mix.h" +#include +#include +#include #include "code940/940shared.h" #include "plat.h" #include "940ctl.h" diff --git a/platform/gp2x/code940/940.c b/platform/gp2x/code940/940.c index db51fdc9..4ab8bad1 100644 --- a/platform/gp2x/code940/940.c +++ b/platform/gp2x/code940/940.c @@ -2,7 +2,7 @@ // (c) Copyright 2006-2007, Grazvydas "notaz" Ignotas #include "940shared.h" -#include "../../common/helix/pub/mp3dec.h" +#include static _940_data_t *shared_data = (_940_data_t *) 0x00100000; static _940_ctl_t *shared_ctl = (_940_ctl_t *) 0x00200000; diff --git a/platform/gp2x/code940/940shared.h b/platform/gp2x/code940/940shared.h index 6f12a32f..9897c1ca 100644 --- a/platform/gp2x/code940/940shared.h +++ b/platform/gp2x/code940/940shared.h @@ -1,4 +1,4 @@ -#include "../../../pico/sound/ym2612.h" +#include // max 16 jobs, lower num means higher prio enum _940_job_t { diff --git a/platform/gp2x/code940/Makefile b/platform/gp2x/code940/Makefile index 8561551b..6968f835 100644 --- a/platform/gp2x/code940/Makefile +++ b/platform/gp2x/code940/Makefile @@ -14,7 +14,7 @@ CROSS ?= arm-linux-gnueabi- # settings #up = 1 -CFLAGS += -O2 -Wall -mno-thumb-interwork -fstrict-aliasing -ffast-math +CFLAGS += -O3 -Wall -mno-thumb-interwork -fstrict-aliasing -fno-stack-protector -fno-common -ffast-math CFLAGS += -I../../common/helix/pub -I../../.. -I. -D__GP2X__ -DARM CFLAGS += -mcpu=arm940t -mtune=arm940t -mabi=apcs-gnu -mfloat-abi=soft -mfpu=fpa LDFLAGS = -static -e code940 -Ttext 0x0 -L$(lgcc_path) -lgcc @@ -66,9 +66,6 @@ code940.elf : $(OBJS940) $(LIBHELIX) @echo ">>>" $@ $(GCC) $(CFLAGS) -Os -DEXTERNAL_YM2612 -c $< -o $@ -mix.o : ../../../pico/sound/mix.s - @echo ">>>" $@ - $(GCC) $(CFLAGS) -DEXTERNAL_YM2612 -c $< -o $@ misc_arm.o : ../../../pico/misc_arm.s @echo ">>>" $@ $(GCC) $(CFLAGS) -DEXTERNAL_YM2612 -c $< -o $@ diff --git a/platform/gp2x/code940/mp3test.c b/platform/gp2x/code940/mp3test.c index cd2a6651..6ffd09c8 100644 --- a/platform/gp2x/code940/mp3test.c +++ b/platform/gp2x/code940/mp3test.c @@ -13,7 +13,7 @@ //#include "emu.h" //#include "menu.h" #include "../asmutils.h" -#include "../../helix/pub/mp3dec.h" +#include /* we will need some gp2x internals here */ extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */ diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index dd3b90e8..d889fb20 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -17,7 +17,7 @@ #ifndef _WIN32 #ifndef NO_MMAP #ifdef __SWITCH__ -#include "../switch/mman.h" +#include "switch/mman.h" #else #include #endif @@ -37,8 +37,9 @@ #endif #if defined(RENDER_GSKIT_PS2) +#include #include "libretro-common/include/libretro_gskit_ps2.h" -#include "../ps2/asm.h" +#include "ps2/asm.h" #endif #ifdef _3DS diff --git a/platform/ps2/Draw_mips_r5900.s b/platform/libretro/ps2/Draw_mips_r5900.s similarity index 100% rename from platform/ps2/Draw_mips_r5900.s rename to platform/libretro/ps2/Draw_mips_r5900.s diff --git a/platform/ps2/Memory_mips_r5900.s b/platform/libretro/ps2/Memory_mips_r5900.s similarity index 100% rename from platform/ps2/Memory_mips_r5900.s rename to platform/libretro/ps2/Memory_mips_r5900.s diff --git a/platform/ps2/asm.h b/platform/libretro/ps2/asm.h similarity index 100% rename from platform/ps2/asm.h rename to platform/libretro/ps2/asm.h diff --git a/platform/ps2/asm.s b/platform/libretro/ps2/asm.s similarity index 100% rename from platform/ps2/asm.s rename to platform/libretro/ps2/asm.s diff --git a/platform/switch/mman.h b/platform/libretro/switch/mman.h similarity index 100% rename from platform/switch/mman.h rename to platform/libretro/switch/mman.h diff --git a/platform/linux/emu.c b/platform/linux/emu.c index 286bff70..c99681ed 100644 --- a/platform/linux/emu.c +++ b/platform/linux/emu.c @@ -47,9 +47,9 @@ static void draw_cd_leds(void) #define p(x) px[(x)*2 >> 2] = px[((x)*2 >> 2) + 1] // 16-bit modes - unsigned int *px = (unsigned int *)((short *)g_screen_ptr + scr_offs); - unsigned int col_g = (led_reg & 2) ? 0x06000600 : 0; - unsigned int col_r = (led_reg & 1) ? 0xc000c000 : 0; + uint32_t *px = (uint32_t *)((short *)g_screen_ptr + scr_offs); + uint32_t col_g = (led_reg & 2) ? 0x06000600 : 0; + uint32_t col_r = (led_reg & 1) ? 0xc000c000 : 0; p(pitch*0) = p(pitch*1) = p(pitch*2) = col_g; p(pitch*0 + led_offs) = p(pitch*1 + led_offs) = p(pitch*2 + led_offs) = col_r; #undef p diff --git a/platform/linux/io.c b/platform/linux/io.c index 74cf30f3..7fdb298e 100644 --- a/platform/linux/io.c +++ b/platform/linux/io.c @@ -13,7 +13,7 @@ #include "../libpicofe/input.h" #include "../common/emu.h" #include "../common/input_pico.h" -#include "version.h" +#include "../common/version.h" #include "log_io.h" diff --git a/platform/psp/emu.c b/platform/psp/emu.c index e138ce8e..93e55c95 100644 --- a/platform/psp/emu.c +++ b/platform/psp/emu.c @@ -23,7 +23,6 @@ #include "asm_utils.h" #include "../common/emu.h" #include "../common/config.h" -#include "../common/lprintf.h" #include #include diff --git a/platform/psp/main.c b/platform/psp/main.c index 989ce5c7..94e38a44 100644 --- a/platform/psp/main.c +++ b/platform/psp/main.c @@ -14,7 +14,7 @@ #include "../common/menu.h" #include "../common/emu.h" #include "../common/config.h" -#include "../common/lprintf.h" +#include "../libpicofe/lprintf.h" #ifdef GPROF #include diff --git a/platform/psp/menu.c b/platform/psp/menu.c index 1b714238..12fd728b 100644 --- a/platform/psp/menu.c +++ b/platform/psp/menu.c @@ -27,9 +27,8 @@ #include "../common/menu.h" #include "../common/emu.h" #include "../common/readpng.h" -#include "../common/lprintf.h" #include "../common/input.h" -#include "version.h" +#include "../common/version.h" #include #include @@ -51,8 +50,6 @@ void menu_darken_bg(void *dst, const void *src, int pixels, int darker); static void menu_prepare_bg(int use_game_bg, int use_fg); -static unsigned int inp_prev = 0; - void menu_draw_begin(void) { // short *src = (short *)bg_buffer, *dst = (short *)menu_screen; diff --git a/platform/psp/mp3.c b/platform/psp/mp3.c index 18624399..eac13ffd 100644 --- a/platform/psp/mp3.c +++ b/platform/psp/mp3.c @@ -14,9 +14,9 @@ #include #include -#include "../../pico/pico_int.h" -#include "../../pico/sound/mix.h" -#include "../common/lprintf.h" +#include +#include +#include "../libpicofe/lprintf.h" int mp3_last_error = 0; diff --git a/platform/psp/psp.c b/platform/psp/psp.c index 8aad4c07..a5bfe3a6 100644 --- a/platform/psp/psp.c +++ b/platform/psp/psp.c @@ -21,8 +21,8 @@ #include "psp.h" #include "emu.h" -#include "../common/lprintf.h" -#include "version.h" +#include +#include "../common/version.h" extern int pico_main(void); diff --git a/platform/win32/main.c b/platform/win32/main.c index eb55e0e0..0484b3ed 100644 --- a/platform/win32/main.c +++ b/platform/win32/main.c @@ -2,15 +2,14 @@ #include #include -#include "../../pico/pico.h" +#include #include "../common/readpng.h" #include "../common/config.h" -#include "../common/lprintf.h" #include "../common/emu.h" #include "../common/menu.h" #include "../common/input.h" #include "../common/plat.h" -#include "version.h" +#include "../common/version.h" #include "direct.h" #include "in_vk.h" diff --git a/platform/win32/plat.c b/platform/win32/plat.c index 54af8292..70d4027f 100644 --- a/platform/win32/plat.c +++ b/platform/win32/plat.c @@ -8,11 +8,10 @@ #include #include -#include "../common/lprintf.h" #include "../common/plat.h" #include "../common/emu.h" -#include "../../pico/pico.h" -#include "version.h" +#include "../common/version.h" +#include #include "direct.h" #include "dsnd.h" #include "main.h" diff --git a/tools/bin_to_cso_mp3/bin_to_cso_mp3.c b/tools/bin_to_cso_mp3/bin_to_cso_mp3.c index 39ca7bf2..f78d2280 100644 --- a/tools/bin_to_cso_mp3/bin_to_cso_mp3.c +++ b/tools/bin_to_cso_mp3/bin_to_cso_mp3.c @@ -10,6 +10,7 @@ #include #include #include +#include #ifndef MAX_PATH #define MAX_PATH 1024 @@ -34,14 +35,14 @@ #define LAME_OPTIONS "-h --cbr" -typedef unsigned char u8; -typedef unsigned short int u16; -typedef unsigned int u32; -typedef unsigned long long int u64; -typedef signed char s8; -typedef signed short int s16; -typedef signed int s32; -typedef signed long long int s64; +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; +typedef int8_t s8; +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; typedef enum { diff --git a/tools/drctest.c b/tools/drctest.c index 2eca4222..0d7d8444 100644 --- a/tools/drctest.c +++ b/tools/drctest.c @@ -3,7 +3,7 @@ #include #include -#include "cpu/sh2/compiler.c" +#include struct Pico Pico; SH2 sh2s[2]; diff --git a/tools/mkoffsets.c b/tools/mkoffsets.c index 7e57383a..609b8840 100644 --- a/tools/mkoffsets.c +++ b/tools/mkoffsets.c @@ -1,7 +1,7 @@ #include #include -#include "../pico/pico_int.h" +#include #define DUMP(f, prefix, type, field) \ fprintf(f, "#define %-20s 0x%02x\n", \ diff --git a/tools/mkoffsets.sh b/tools/mkoffsets.sh index f681b060..c347587c 100755 --- a/tools/mkoffsets.sh +++ b/tools/mkoffsets.sh @@ -103,7 +103,7 @@ get_define () # prefix struct member member... field=$(echo $* | sed 's/ /./g') name=$(echo $* | sed 's/ /_/g') echo '#include ' > /tmp/getoffs.c - echo '#include "pico/pico_int.h"' >> /tmp/getoffs.c + echo '#include ' >> /tmp/getoffs.c echo "static struct $struct p;" >> /tmp/getoffs.c echo "const int32_t val = (char *)&p.$field - (char*)&p;" >>/tmp/getoffs.c compile_rodata -- 2.39.5