core, structural cleanup, fixes and improvements for type issues #2

This commit is contained in:
kub 2021-01-01 12:43:49 +01:00
parent 5ab80df952
commit f821bb7011
64 changed files with 140 additions and 150 deletions

View file

@ -1,7 +1,7 @@
$(LD) ?= $(CC) $(LD) ?= $(CC)
TARGET ?= PicoDrive TARGET ?= PicoDrive
DEBUG ?= 0 DEBUG ?= 0
CFLAGS += -I. CFLAGS += -I$(PWD)
CYCLONE_CC ?= gcc CYCLONE_CC ?= gcc
CYCLONE_CXX ?= g++ CYCLONE_CXX ?= g++

View file

@ -205,7 +205,7 @@ else ifeq ($(platform), ps2)
ARCH = mipsel ARCH = mipsel
asm_render = 1 asm_render = 1
OBJS += platform/ps2/asm.o OBJS += platform/libretro/ps2/asm.o
# CTR (3DS) # CTR (3DS)
else ifeq ($(platform), ctr) else ifeq ($(platform), ctr)

View file

@ -5,7 +5,7 @@
;@ For commercial use, separate licencing terms must be obtained. ;@ For commercial use, separate licencing terms must be obtained.
#include "../../pico/arm_features.h" #include <pico/arm_features.h>
.data .data
.align 4 .align 4

View file

@ -8,7 +8,7 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include "../pico/pico_int.h" #include <pico/pico_int.h>
#include "debug.h" #include "debug.h"
static char pdb_pending_cmds[128]; static char pdb_pending_cmds[128];

View file

@ -60,6 +60,8 @@
#define FAMEC_EXTRA_INLINE INLINE #define FAMEC_EXTRA_INLINE INLINE
#endif #endif
#include <pico/pico_types.h>
/*
#ifdef u8 #ifdef u8
#undef u8 #undef u8
#endif #endif
@ -95,6 +97,7 @@
#define u32 unsigned int #define u32 unsigned int
#define s32 signed int #define s32 signed int
#define uptr uintptr_t #define uptr uintptr_t
*/
/* /*
typedef unsigned char u8; typedef unsigned char u8;

View file

@ -32,8 +32,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include "../../pico/pico_int.h" #include <pico/pico_int.h>
#include "../../pico/arm_features.h" #include <pico/arm_features.h>
#include "sh2.h" #include "sh2.h"
#include "compiler.h" #include "compiler.h"
#include "../drc/cmn.h" #include "../drc/cmn.h"

View file

@ -9,12 +9,12 @@
// MAME types // MAME types
#ifndef INT8 #ifndef INT8
typedef signed char INT8; typedef s8 INT8;
typedef signed short INT16; typedef s16 INT16;
typedef signed int INT32; typedef s32 INT32;
typedef unsigned int UINT32; typedef u32 UINT32;
typedef unsigned short UINT16; typedef u16 UINT16;
typedef unsigned char UINT8; typedef u8 UINT8;
#endif #endif
#ifdef DRC_SH2 #ifdef DRC_SH2

View file

@ -1,8 +1,8 @@
#ifndef __SH2_H__ #ifndef __SH2_H__
#define __SH2_H__ #define __SH2_H__
#include "../../pico/pico_types.h" #include <pico/pico_types.h>
#include "../../pico/pico_port.h" #include <pico/pico_port.h>
// registers - matches structure order // registers - matches structure order
typedef enum { typedef enum {

View file

@ -7,7 +7,7 @@
*/ */
#include "../pico_int.h" #include "../pico_int.h"
#include "../sound/ym2612.h" #include "../sound/ym2612.h"
#include "../../cpu/sh2/compiler.h" #include <cpu/sh2/compiler.h>
struct Pico32x Pico32x; struct Pico32x Pico32x;
SH2 sh2s[2]; SH2 sh2s[2];

View file

@ -26,19 +26,19 @@ int DrawLineDestIncrement32x;
static void convert_pal555(int invert_prio) static void convert_pal555(int invert_prio)
{ {
unsigned int *ps = (void *)Pico32xMem->pal; u32 *ps = (void *)Pico32xMem->pal;
unsigned int *pd = (void *)Pico32xMem->pal_native; u32 *pd = (void *)Pico32xMem->pal_native;
unsigned int m1 = 0x001f001f; u32 m1 = 0x001f001f;
unsigned int m2 = 0x03e003e0; u32 m2 = 0x03e003e0;
unsigned int m3 = 0xfc00fc00; // includes prio bit u32 m3 = 0xfc00fc00; // includes prio bit
unsigned int inv = 0; u32 inv = 0;
int i; int i;
if (invert_prio) if (invert_prio)
inv = 0x80008000; inv = 0x80008000;
for (i = 0x100/2; i > 0; i--, ps++, pd++) { for (i = 0x100/2; i > 0; i--, ps++, pd++) {
unsigned int t = *ps ^ inv; u32 t = *ps ^ inv;
*pd = PXCONV(t); *pd = PXCONV(t);
} }
@ -48,9 +48,9 @@ static void convert_pal555(int invert_prio)
// direct color mode // direct color mode
#define do_line_dc(pd, p32x, pmd, inv, pmd_draw_code) \ #define do_line_dc(pd, p32x, pmd, inv, pmd_draw_code) \
{ \ { \
const unsigned int m1 = 0x001f; \ const u16 m1 = 0x001f; \
const unsigned int m2 = 0x03e0; \ const u16 m2 = 0x03e0; \
const unsigned int m3 = 0x7c00; \ const u16 m3 = 0x7c00; \
unsigned short t; \ unsigned short t; \
int i = 320; \ int i = 320; \
\ \

View file

@ -7,8 +7,8 @@
@* See COPYING file in the top-level directory. @* See COPYING file in the top-level directory.
@* @*
#include "pico/arm_features.h" #include <pico/arm_features.h>
#include "pico/pico_int_offs.h" #include <pico/pico_int_offs.h>
.extern Pico32x .extern Pico32x
.extern Pico .extern Pico

View file

@ -42,7 +42,7 @@
#include "../pico_int.h" #include "../pico_int.h"
#include "../memory.h" #include "../memory.h"
#include "../../cpu/sh2/compiler.h" #include <cpu/sh2/compiler.h>
DRC_DECLARE_SR; DRC_DECLARE_SR;
static const char str_mars[] = "MARS"; static const char str_mars[] = "MARS";

View file

@ -6,7 +6,7 @@
* See COPYING file in the top-level directory. * See COPYING file in the top-level directory.
*/ */
#include "../pico_int_offs.h" #include <pico/pico_int_offs.h>
@ 32X bank sizes... TODO this should somehow come from an include file @ 32X bank sizes... TODO this should somehow come from an include file
.equ SH2_ROM_SHIFT, 10 @ 0x003fffff .equ SH2_ROM_SHIFT, 10 @ 0x003fffff

View file

@ -25,14 +25,14 @@
#include "../pico_int.h" #include "../pico_int.h"
#include "../memory.h" #include "../memory.h"
#include "../../cpu/sh2/compiler.h" #include <cpu/sh2/compiler.h>
DRC_DECLARE_SR; DRC_DECLARE_SR;
// DMAC handling // DMAC handling
struct dma_chan { struct dma_chan {
unsigned int sar, dar; // src, dst addr u32 sar, dar; // src, dst addr
unsigned int tcr; // transfer count u32 tcr; // transfer count
unsigned int chcr; // chan ctl u32 chcr; // chan ctl
// -- dm dm sm sm ts ts ar am al ds dl tb ta ie te de // -- dm dm sm sm ts ts ar am al ds dl tb ta ie te de
// ts - transfer size: 1, 2, 4, 16 bytes // ts - transfer size: 1, 2, 4, 16 bytes
// ar - auto request if 1, else dreq signal // ar - auto request if 1, else dreq signal
@ -47,11 +47,11 @@ struct dma_chan {
struct dmac { struct dmac {
struct dma_chan chan[2]; struct dma_chan chan[2];
unsigned int vcrdma0; u32 vcrdma0;
unsigned int unknown0; u32 unknown0;
unsigned int vcrdma1; u32 vcrdma1;
unsigned int unknown1; u32 unknown1;
unsigned int dmaor; u32 dmaor;
// -- pr ae nmif dme // -- pr ae nmif dme
// pr - priority: chan0 > chan1 or round-robin // pr - priority: chan0 > chan1 or round-robin
// ae - address error // ae - address error

View file

@ -8,8 +8,8 @@
*/ */
#include "pico_int.h" #include "pico_int.h"
#include "../cpu/debug.h" #include <cpu/debug.h>
#include "../unzip/unzip.h" #include <unzip/unzip.h>
#include <zlib.h> #include <zlib.h>
#ifdef USE_LIBRETRO_VFS #ifdef USE_LIBRETRO_VFS

View file

@ -6,8 +6,8 @@
* See COPYING file in the top-level directory. * See COPYING file in the top-level directory.
*/ */
#include "../../pico_int.h" #include <pico/pico_int.h>
#include "../../../cpu/drc/cmn.h" #include <cpu/drc/cmn.h>
#include "compiler.h" #include "compiler.h"
// FIXME: asm has these hardcoded // FIXME: asm has these hardcoded
@ -39,7 +39,7 @@ void ssp_drc_end(void){}
#endif #endif
#define COUNT_OP #define COUNT_OP
#include "../../../cpu/drc/emit_arm.c" #include <cpu/drc/emit_arm.c>
// ----------------------------------------------------- // -----------------------------------------------------

View file

@ -26,8 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "../../pico_int.h" #include <pico/pico_int.h>
#include "../../memory.h" #include <pico/memory.h>
// for wait loop det // for wait loop det
static void PicoWrite16_dram(u32 a, u32 d) static void PicoWrite16_dram(u32 a, u32 d)

View file

@ -206,7 +206,7 @@
* ops not used by VR are not implemented * ops not used by VR are not implemented
*/ */
#include "../../pico_int.h" #include <pico/pico_int.h>
#define u32 unsigned int #define u32 unsigned int

View file

@ -6,7 +6,7 @@
@* See COPYING file in the top-level directory. @* See COPYING file in the top-level directory.
@* @*
#include "../../arm_features.h" #include <pico/arm_features.h>
@.syntax unified @.syntax unified
.text .text

View file

@ -5,12 +5,12 @@
#undef int16 #undef int16
#undef int32 #undef int32
#define uint8 unsigned char #define uint8 u8
#define uint16 unsigned short #define uint16 u16
#define uint32 unsigned int #define uint32 u32
#define int8 signed char #define int8 s8
#define int16 signed short #define int16 s16
#define int32 signed int #define int32 s32
#define READ_BYTE(BASE, ADDR) (BASE)[(ADDR)^1] #define READ_BYTE(BASE, ADDR) (BASE)[(ADDR)^1]
#define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[(ADDR)^1] = (VAL) #define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[(ADDR)^1] = (VAL)

View file

@ -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 */ /* make sure 2M mode is enabled */
if (!(Pico_mcd->s68k_regs[3] & 0x04)) if (!(Pico_mcd->s68k_regs[3] & 0x04))

View file

@ -14,7 +14,7 @@
PICO_INTERNAL void DmaSlowCell(u32 source, u32 a, int len, unsigned char inc) PICO_INTERNAL void DmaSlowCell(u32 source, u32 a, int len, unsigned char inc)
{ {
unsigned char *base; unsigned char *base;
unsigned int asrc, a2; u32 asrc, a2;
u16 *r; u16 *r;
base = Pico_mcd->word_ram1M[Pico_mcd->s68k_regs[3]&1]; base = Pico_mcd->word_ram1M[Pico_mcd->s68k_regs[3]&1];

View file

@ -6,8 +6,8 @@
@* See COPYING file in the top-level directory. @* See COPYING file in the top-level directory.
@* @*
#include "../arm_features.h" #include <pico/arm_features.h>
#include "../pico_int_offs.h" #include <pico/pico_int_offs.h>
.equiv PCM_STEP_SHIFT, 11 .equiv PCM_STEP_SHIFT, 11

View file

@ -8,7 +8,6 @@
#include "pico_int.h" #include "pico_int.h"
typedef unsigned char u8;
static unsigned int pppc, ops=0; static unsigned int pppc, ops=0;
extern unsigned int lastread_a, lastread_d[16], lastwrite_cyc_d[16], lastwrite_mus_d[16]; extern unsigned int lastread_a, lastread_d[16], lastwrite_cyc_d[16], lastwrite_mus_d[16];

View file

@ -53,7 +53,7 @@ static unsigned char DefHighCol[8+320+8];
unsigned char *HighColBase = DefHighCol; unsigned char *HighColBase = DefHighCol;
int HighColIncrement; int HighColIncrement;
static u16 DefOutBuff[320*2]; static u16 DefOutBuff[320*2] ALIGNED(4);
void *DrawLineDestBase = DefOutBuff; void *DrawLineDestBase = DefOutBuff;
int DrawLineDestIncrement; int DrawLineDestIncrement;
@ -200,7 +200,7 @@ TileFlipMaker(TileFlipNonSH, pix_nonsh)
// draw sprite pixels, process operator colors // draw sprite pixels, process operator colors
#define pix_sh(x) \ #define pix_sh(x) \
if (likely(t)) \ 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) TileNormMaker(TileNormSH, pix_sh)
TileFlipMaker(TileFlipSH, pix_sh) TileFlipMaker(TileFlipSH, pix_sh)
@ -208,7 +208,7 @@ TileFlipMaker(TileFlipSH, pix_sh)
// draw sprite pixels, mark but don't process operator colors // draw sprite pixels, mark but don't process operator colors
#define pix_sh_markop(x) \ #define pix_sh_markop(x) \
if (likely(t)) \ 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) TileNormMaker(TileNormSH_markop, pix_sh_markop)
TileFlipMaker(TileFlipSH_markop, pix_sh_markop) TileFlipMaker(TileFlipSH_markop, pix_sh_markop)

View file

@ -7,7 +7,6 @@
*/ */
#include "../pico_int.h" #include "../pico_int.h"
#include "../memory.h" #include "../memory.h"
#include "../sound/sn76496.h"
/* /*
void dump(u16 w) void dump(u16 w)

View file

@ -11,6 +11,7 @@
#define PICO_INTERNAL_INCLUDED #define PICO_INTERNAL_INCLUDED
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "pico_types.h"
#include "pico_port.h" #include "pico_port.h"
#include "pico.h" #include "pico.h"
#include "carthw/carthw.h" #include "carthw/carthw.h"
@ -31,11 +32,9 @@
extern "C" { extern "C" {
#endif #endif
#include "pico_types.h"
// ----------------------- 68000 CPU ----------------------- // ----------------------- 68000 CPU -----------------------
#ifdef EMU_C68K #ifdef EMU_C68K
#include "../cpu/cyclone/Cyclone.h" #include <cpu/cyclone/Cyclone.h>
extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k; extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k;
#define SekCyclesLeft PicoCpuCM68k.cycles // cycles left for this run #define SekCyclesLeft PicoCpuCM68k.cycles // cycles left for this run
#define SekCyclesLeftS68k PicoCpuCS68k.cycles #define SekCyclesLeftS68k PicoCpuCS68k.cycles
@ -60,7 +59,7 @@ extern struct Cyclone PicoCpuCM68k, PicoCpuCS68k;
#endif #endif
#ifdef EMU_F68K #ifdef EMU_F68K
#include "../cpu/fame/fame.h" #include <cpu/fame/fame.h>
extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k; extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k;
#define SekCyclesLeft PicoCpuFM68k.io_cycle_counter #define SekCyclesLeft PicoCpuFM68k.io_cycle_counter
#define SekCyclesLeftS68k PicoCpuFS68k.io_cycle_counter #define SekCyclesLeftS68k PicoCpuFS68k.io_cycle_counter
@ -91,7 +90,7 @@ extern M68K_CONTEXT PicoCpuFM68k, PicoCpuFS68k;
#endif #endif
#ifdef EMU_M68K #ifdef EMU_M68K
#include "../cpu/musashi/m68kcpu.h" #include <cpu/musashi/m68kcpu.h>
extern m68ki_cpu_core PicoCpuMM68k, PicoCpuMS68k; extern m68ki_cpu_core PicoCpuMM68k, PicoCpuMS68k;
#ifndef SekCyclesLeft #ifndef SekCyclesLeft
#define SekCyclesLeft PicoCpuMM68k.cyc_remaining_cycles #define SekCyclesLeft PicoCpuMM68k.cyc_remaining_cycles
@ -160,7 +159,7 @@ extern unsigned int SekCycleAimS68k;
// ----------------------- Z80 CPU ----------------------- // ----------------------- Z80 CPU -----------------------
#if defined(_USE_DRZ80) #if defined(_USE_DRZ80)
#include "../cpu/DrZ80/drz80.h" #include <cpu/DrZ80/drz80.h>
extern struct DrZ80 drZ80; extern struct DrZ80 drZ80;
@ -175,7 +174,7 @@ extern struct DrZ80 drZ80;
#define z80_pc() (drZ80.Z80PC - drZ80.Z80PC_BASE) #define z80_pc() (drZ80.Z80PC - drZ80.Z80PC_BASE)
#elif defined(_USE_CZ80) #elif defined(_USE_CZ80)
#include "../cpu/cz80/cz80.h" #include <cpu/cz80/cz80.h>
#define z80_run(cycles) Cz80_Exec(&CZ80, cycles) #define z80_run(cycles) Cz80_Exec(&CZ80, cycles)
#define z80_run_nr(cycles) Cz80_Exec(&CZ80, cycles) #define z80_run_nr(cycles) Cz80_Exec(&CZ80, cycles)
@ -209,7 +208,7 @@ extern struct DrZ80 drZ80;
// ----------------------- SH2 CPU ----------------------- // ----------------------- SH2 CPU -----------------------
#include "cpu/sh2/sh2.h" #include <cpu/sh2/sh2.h>
extern SH2 sh2s[2]; extern SH2 sh2s[2];
#define msh2 sh2s[0] #define msh2 sh2s[0]
@ -721,7 +720,7 @@ int load_cd_image(const char *cd_img_name, int *type);
// cd/gfx.c // cd/gfx.c
void gfx_init(void); void gfx_init(void);
void gfx_start(unsigned int base); void gfx_start(u32 base);
void gfx_update(unsigned int cycles); void gfx_update(unsigned int cycles);
int gfx_context_save(unsigned char *state); int gfx_context_save(unsigned char *state);
int gfx_context_load(const unsigned char *state); int gfx_context_load(const unsigned char *state);

View file

@ -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 */ /* idle loop detection, not to be used in CD mode */
#ifdef EMU_C68K #ifdef EMU_C68K
#include "cpu/cyclone/tools/idle.h" #include <cpu/cyclone/tools/idle.h>
#endif #endif
static unsigned short **idledet_ptrs = NULL; static unsigned short **idledet_ptrs = NULL;

View file

@ -7,7 +7,7 @@
* See COPYING file in the top-level directory. * See COPYING file in the top-level directory.
*/ */
#include "string.h" #include <string.h>
#define MAXOUT (+32767) #define MAXOUT (+32767)
#define MINOUT (-32768) #define MINOUT (-32768)

View file

@ -6,16 +6,16 @@
#define _H_FM_FM_ #define _H_FM_FM_
/* compiler dependence */ /* compiler dependence */
#include <stdint.h> #include "../pico_types.h"
#ifndef UINT8 #ifndef UINT8
typedef uint8_t UINT8; /* unsigned 8bit */ typedef u8 UINT8; /* unsigned 8bit */
typedef uint16_t UINT16; /* unsigned 16bit */ typedef u16 UINT16; /* unsigned 16bit */
typedef uint32_t UINT32; /* unsigned 32bit */ typedef u32 UINT32; /* unsigned 32bit */
#endif #endif
#ifndef INT8 #ifndef INT8
typedef int8_t INT8; /* signed 8bit */ typedef s8 INT8; /* signed 8bit */
typedef int16_t INT16; /* signed 16bit */ typedef s16 INT16; /* signed 16bit */
typedef int32_t INT32; /* signed 32bit */ typedef s32 INT32; /* signed 32bit */
#endif #endif
#if 1 #if 1
@ -183,7 +183,7 @@ int YM2612PicoStateLoad2(int *tat, int *tbt);
#define YM2612PicoStateLoad YM2612PicoStateLoad_ #define YM2612PicoStateLoad YM2612PicoStateLoad_
#else #else
/* GP2X specific */ /* GP2X specific */
#include "../../platform/gp2x/940ctl.h" #include <platform/gp2x/940ctl.h>
#define YM2612Init(baseclock,rate,ssg) do { \ #define YM2612Init(baseclock,rate,ssg) do { \
if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, ssg); \ if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, ssg); \
else YM2612Init_(baseclock, rate, ssg); \ else YM2612Init_(baseclock, rate, ssg); \

View file

@ -13,7 +13,7 @@
@ vim:filetype=armasm @ vim:filetype=armasm
#include "../arm_features.h" #include <pico/arm_features.h>
@ very simple YM2612 output rate to sample rate adaption (~500k cycles @44100) @ very simple YM2612 output rate to sample rate adaption (~500k cycles @44100)
#define INTERPOL #define INTERPOL

View file

@ -9,7 +9,7 @@
#include "pico_int.h" #include "pico_int.h"
#include <zlib.h> #include <zlib.h>
#include "../cpu/sh2/sh2.h" #include <cpu/sh2/sh2.h>
#include "sound/ym2612.h" #include "sound/ym2612.h"
#include "sound/emu2413/emu2413.h" #include "sound/emu2413/emu2413.h"
#include "state.h" #include "state.h"

View file

@ -22,7 +22,7 @@ static int blankline; // display disabled for this line
u32 SATaddr, SATmask; // VRAM addr of sprite attribute table 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 /* VDP FIFO implementation

View file

@ -96,10 +96,6 @@ int main(int argc, char *argv[])
emu_init(); emu_init();
#ifdef GPERF
ProfilerStart("gperf.out");
#endif
engineState = PGS_Menu; engineState = PGS_Menu;
if (argc > 1) if (argc > 1)
@ -142,7 +138,13 @@ int main(int argc, char *argv[])
/* vvv fallthrough */ /* vvv fallthrough */
case PGS_Running: case PGS_Running:
#ifdef GPERF
ProfilerStart("gperf.out");
#endif
emu_loop(); emu_loop();
#ifdef GPERF
ProfilerStop();
#endif
break; break;
case PGS_Quit: case PGS_Quit:
@ -155,9 +157,6 @@ int main(int argc, char *argv[])
} }
endloop: endloop:
#ifdef GPERF
ProfilerStop();
#endif
emu_finish(); emu_finish();
plat_finish(); plat_finish();

View file

@ -55,15 +55,15 @@ static unsigned short fname2color(const char *fname)
return 0xffff; return 0xffff;
} }
#include "../libpicofe/menu.c" #include <platform/libpicofe/menu.c>
static const char *men_dummy[] = { NULL }; static const char *men_dummy[] = { NULL };
/* platform specific options and handlers */ /* platform specific options and handlers */
#if defined(__GP2X__) #if defined(__GP2X__)
#include "../gp2x/menu.c" #include <platform/gp2x/menu.c>
#elif defined(PANDORA) #elif defined(PANDORA)
#include "../pandora/menu.c" #include <platform/pandora/menu.c>
#else #else
#define MENU_OPTIONS_GFX #define MENU_OPTIONS_GFX
#define MENU_OPTIONS_ADV #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) 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) d += (g_menuscreen_h / 2 - h * 2 / 2)
* g_menuscreen_w / 2; * g_menuscreen_w / 2;
d += (g_menuscreen_w / 2 - w * 2 / 2) / 2; d += (g_menuscreen_w / 2 - w * 2 / 2) / 2;

View file

@ -33,7 +33,7 @@ static struct in_pdata in_sdl_platform_data = {
static int yuv_ry[32], yuv_gy[32], yuv_by[32]; 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_u[32 * 2], yuv_v[32 * 2];
static unsigned char yuv_y[256]; 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) void bgr_to_uyvy_init(void)
{ {

View file

@ -8,9 +8,9 @@
#include "kgsdk/Framework2D.h" #include "kgsdk/Framework2D.h"
#include "kgsdk/FrameworkAudio.h" #include "kgsdk/FrameworkAudio.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/lprintf.h"
#include "../common/arm_utils.h" #include "../common/arm_utils.h"
#include "../common/config.h" #include "../common/config.h"
#include "../libpicofe/lprintf.h"
#include "emu.h" #include "emu.h"
#include "menu.h" #include "menu.h"
#include "giz.h" #include "giz.h"

View file

@ -11,7 +11,7 @@
#include "kgsdk/Framework.h" #include "kgsdk/Framework.h"
#include "kgsdk/Framework2D.h" #include "kgsdk/Framework2D.h"
#include "giz.h" #include "giz.h"
#include "version.h" #include "../common/version.h"
#define LOG_FILE "log.log" #define LOG_FILE "log.log"

View file

@ -14,7 +14,7 @@
#include "../common/menu.h" #include "../common/menu.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/config.h" #include "../common/config.h"
#include "version.h" #include "../common/version.h"
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)

View file

@ -28,7 +28,7 @@
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/readpng.h" #include "../common/readpng.h"
#include "../common/input.h" #include "../common/input.h"
#include "version.h" #include "../common/version.h"
#include <pico/pico_int.h> #include <pico/pico_int.h>
#include <pico/patch.h> #include <pico/patch.h>
@ -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); void menu_darken_bg(void *dst, const void *src, int pixels, int darker);
static void menu_prepare_bg(int use_game_bg); static void menu_prepare_bg(int use_game_bg);
static unsigned int inp_prev = 0;
void menu_draw_begin(int use_bgbuff) void menu_draw_begin(int use_bgbuff)
{ {
if (use_bgbuff) if (use_bgbuff)
@ -1457,14 +1455,14 @@ static void menu_loop_root(void)
// warning: alignment // warning: alignment
void menu_darken_bg(void *dst, const void *src, int pixels, int darker) void menu_darken_bg(void *dst, const void *src, int pixels, int darker)
{ {
unsigned int *dest = dst; u32 *dest = dst;
const unsigned int *srce = src; const u32 *srce = src;
pixels /= 2; pixels /= 2;
if (darker) if (darker)
{ {
while (pixels--) while (pixels--)
{ {
unsigned int p = *srce++; u32 p = *srce++;
*dest++ = ((p&0xf79ef79e)>>1) - ((p&0xc618c618)>>3); *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--) while (pixels--)
{ {
unsigned int p = *srce++; u32 p = *srce++;
*dest++ = (p&0xf79ef79e)>>1; *dest++ = (p&0xf79ef79e)>>1;
} }
} }

View file

@ -22,9 +22,9 @@
#include "../common/arm_utils.h" #include "../common/arm_utils.h"
#include "../common/menu_pico.h" #include "../common/menu_pico.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../../pico/pico_int.h" #include <pico/pico_int.h>
#include "../../pico/sound/ym2612.h" #include <pico/sound/ym2612.h>
#include "../../pico/sound/mix.h" #include <pico/sound/mix.h>
#include "code940/940shared.h" #include "code940/940shared.h"
#include "plat.h" #include "plat.h"
#include "940ctl.h" #include "940ctl.h"

View file

@ -2,7 +2,7 @@
// (c) Copyright 2006-2007, Grazvydas "notaz" Ignotas // (c) Copyright 2006-2007, Grazvydas "notaz" Ignotas
#include "940shared.h" #include "940shared.h"
#include "../../common/helix/pub/mp3dec.h" #include <platform/common/helix/pub/mp3dec.h>
static _940_data_t *shared_data = (_940_data_t *) 0x00100000; static _940_data_t *shared_data = (_940_data_t *) 0x00100000;
static _940_ctl_t *shared_ctl = (_940_ctl_t *) 0x00200000; static _940_ctl_t *shared_ctl = (_940_ctl_t *) 0x00200000;

View file

@ -1,4 +1,4 @@
#include "../../../pico/sound/ym2612.h" #include <pico/sound/ym2612.h>
// max 16 jobs, lower num means higher prio // max 16 jobs, lower num means higher prio
enum _940_job_t { enum _940_job_t {

View file

@ -14,7 +14,7 @@ CROSS ?= arm-linux-gnueabi-
# settings # settings
#up = 1 #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 += -I../../common/helix/pub -I../../.. -I. -D__GP2X__ -DARM
CFLAGS += -mcpu=arm940t -mtune=arm940t -mabi=apcs-gnu -mfloat-abi=soft -mfpu=fpa CFLAGS += -mcpu=arm940t -mtune=arm940t -mabi=apcs-gnu -mfloat-abi=soft -mfpu=fpa
LDFLAGS = -static -e code940 -Ttext 0x0 -L$(lgcc_path) -lgcc LDFLAGS = -static -e code940 -Ttext 0x0 -L$(lgcc_path) -lgcc
@ -66,9 +66,6 @@ code940.elf : $(OBJS940) $(LIBHELIX)
@echo ">>>" $@ @echo ">>>" $@
$(GCC) $(CFLAGS) -Os -DEXTERNAL_YM2612 -c $< -o $@ $(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 misc_arm.o : ../../../pico/misc_arm.s
@echo ">>>" $@ @echo ">>>" $@
$(GCC) $(CFLAGS) -DEXTERNAL_YM2612 -c $< -o $@ $(GCC) $(CFLAGS) -DEXTERNAL_YM2612 -c $< -o $@

View file

@ -13,7 +13,7 @@
//#include "emu.h" //#include "emu.h"
//#include "menu.h" //#include "menu.h"
#include "../asmutils.h" #include "../asmutils.h"
#include "../../helix/pub/mp3dec.h" #include <platform/common/helix/pub/mp3dec.h>
/* we will need some gp2x internals here */ /* we will need some gp2x internals here */
extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */ extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */

View file

@ -17,7 +17,7 @@
#ifndef _WIN32 #ifndef _WIN32
#ifndef NO_MMAP #ifndef NO_MMAP
#ifdef __SWITCH__ #ifdef __SWITCH__
#include "../switch/mman.h" #include "switch/mman.h"
#else #else
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
@ -37,8 +37,9 @@
#endif #endif
#if defined(RENDER_GSKIT_PS2) #if defined(RENDER_GSKIT_PS2)
#include <malloc.h>
#include "libretro-common/include/libretro_gskit_ps2.h" #include "libretro-common/include/libretro_gskit_ps2.h"
#include "../ps2/asm.h" #include "ps2/asm.h"
#endif #endif
#ifdef _3DS #ifdef _3DS

View file

@ -47,9 +47,9 @@ static void draw_cd_leds(void)
#define p(x) px[(x)*2 >> 2] = px[((x)*2 >> 2) + 1] #define p(x) px[(x)*2 >> 2] = px[((x)*2 >> 2) + 1]
// 16-bit modes // 16-bit modes
unsigned int *px = (unsigned int *)((short *)g_screen_ptr + scr_offs); uint32_t *px = (uint32_t *)((short *)g_screen_ptr + scr_offs);
unsigned int col_g = (led_reg & 2) ? 0x06000600 : 0; uint32_t col_g = (led_reg & 2) ? 0x06000600 : 0;
unsigned int col_r = (led_reg & 1) ? 0xc000c000 : 0; uint32_t col_r = (led_reg & 1) ? 0xc000c000 : 0;
p(pitch*0) = p(pitch*1) = p(pitch*2) = col_g; 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; p(pitch*0 + led_offs) = p(pitch*1 + led_offs) = p(pitch*2 + led_offs) = col_r;
#undef p #undef p

View file

@ -13,7 +13,7 @@
#include "../libpicofe/input.h" #include "../libpicofe/input.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/input_pico.h" #include "../common/input_pico.h"
#include "version.h" #include "../common/version.h"
#include "log_io.h" #include "log_io.h"

View file

@ -23,7 +23,6 @@
#include "asm_utils.h" #include "asm_utils.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/config.h" #include "../common/config.h"
#include "../common/lprintf.h"
#include <pico/pico_int.h> #include <pico/pico_int.h>
#include <pico/cd/cue.h> #include <pico/cd/cue.h>

View file

@ -14,7 +14,7 @@
#include "../common/menu.h" #include "../common/menu.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/config.h" #include "../common/config.h"
#include "../common/lprintf.h" #include "../libpicofe/lprintf.h"
#ifdef GPROF #ifdef GPROF
#include <pspprof.h> #include <pspprof.h>

View file

@ -27,9 +27,8 @@
#include "../common/menu.h" #include "../common/menu.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/readpng.h" #include "../common/readpng.h"
#include "../common/lprintf.h"
#include "../common/input.h" #include "../common/input.h"
#include "version.h" #include "../common/version.h"
#include <pico/pico_int.h> #include <pico/pico_int.h>
#include <pico/patch.h> #include <pico/patch.h>
@ -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 void menu_prepare_bg(int use_game_bg, int use_fg);
static unsigned int inp_prev = 0;
void menu_draw_begin(void) void menu_draw_begin(void)
{ {
// short *src = (short *)bg_buffer, *dst = (short *)menu_screen; // short *src = (short *)bg_buffer, *dst = (short *)menu_screen;

View file

@ -14,9 +14,9 @@
#include <pspaudiocodec.h> #include <pspaudiocodec.h>
#include <kubridge.h> #include <kubridge.h>
#include "../../pico/pico_int.h" #include <pico/pico_int.h>
#include "../../pico/sound/mix.h" #include <pico/sound/mix.h>
#include "../common/lprintf.h" #include "../libpicofe/lprintf.h"
int mp3_last_error = 0; int mp3_last_error = 0;

View file

@ -21,8 +21,8 @@
#include "psp.h" #include "psp.h"
#include "emu.h" #include "emu.h"
#include "../common/lprintf.h" #include <pico/pico_int.h>
#include "version.h" #include "../common/version.h"
extern int pico_main(void); extern int pico_main(void);

View file

@ -2,15 +2,14 @@
#include <commdlg.h> #include <commdlg.h>
#include <stdio.h> #include <stdio.h>
#include "../../pico/pico.h" #include <pico/pico.h>
#include "../common/readpng.h" #include "../common/readpng.h"
#include "../common/config.h" #include "../common/config.h"
#include "../common/lprintf.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../common/menu.h" #include "../common/menu.h"
#include "../common/input.h" #include "../common/input.h"
#include "../common/plat.h" #include "../common/plat.h"
#include "version.h" #include "../common/version.h"
#include "direct.h" #include "direct.h"
#include "in_vk.h" #include "in_vk.h"

View file

@ -8,11 +8,10 @@
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include "../common/lprintf.h"
#include "../common/plat.h" #include "../common/plat.h"
#include "../common/emu.h" #include "../common/emu.h"
#include "../../pico/pico.h" #include "../common/version.h"
#include "version.h" #include <pico/pico.h>
#include "direct.h" #include "direct.h"
#include "dsnd.h" #include "dsnd.h"
#include "main.h" #include "main.h"

View file

@ -10,6 +10,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <stdint.h>
#ifndef MAX_PATH #ifndef MAX_PATH
#define MAX_PATH 1024 #define MAX_PATH 1024
@ -34,14 +35,14 @@
#define LAME_OPTIONS "-h --cbr" #define LAME_OPTIONS "-h --cbr"
typedef unsigned char u8; typedef uint8_t u8;
typedef unsigned short int u16; typedef uint16_t u16;
typedef unsigned int u32; typedef uint32_t u32;
typedef unsigned long long int u64; typedef uint64_t u64;
typedef signed char s8; typedef int8_t s8;
typedef signed short int s16; typedef int16_t s16;
typedef signed int s32; typedef int32_t s32;
typedef signed long long int s64; typedef int64_t s64;
typedef enum typedef enum
{ {

View file

@ -3,7 +3,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include "cpu/sh2/compiler.c" #include <cpu/sh2/compiler.c>
struct Pico Pico; struct Pico Pico;
SH2 sh2s[2]; SH2 sh2s[2];

View file

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stddef.h> #include <stddef.h>
#include "../pico/pico_int.h" #include <pico/pico_int.h>
#define DUMP(f, prefix, type, field) \ #define DUMP(f, prefix, type, field) \
fprintf(f, "#define %-20s 0x%02x\n", \ fprintf(f, "#define %-20s 0x%02x\n", \

View file

@ -103,7 +103,7 @@ get_define () # prefix struct member member...
field=$(echo $* | sed 's/ /./g') field=$(echo $* | sed 's/ /./g')
name=$(echo $* | sed 's/ /_/g') name=$(echo $* | sed 's/ /_/g')
echo '#include <stdint.h>' > /tmp/getoffs.c echo '#include <stdint.h>' > /tmp/getoffs.c
echo '#include "pico/pico_int.h"' >> /tmp/getoffs.c echo '#include <pico/pico_int.h>' >> /tmp/getoffs.c
echo "static struct $struct p;" >> /tmp/getoffs.c echo "static struct $struct p;" >> /tmp/getoffs.c
echo "const int32_t val = (char *)&p.$field - (char*)&p;" >>/tmp/getoffs.c echo "const int32_t val = (char *)&p.$field - (char*)&p;" >>/tmp/getoffs.c
compile_rodata compile_rodata