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

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

View file

@ -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; \
\

View file

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

View file

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

View file

@ -6,7 +6,7 @@
* 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
.equ SH2_ROM_SHIFT, 10 @ 0x003fffff

View file

@ -25,14 +25,14 @@
#include "../pico_int.h"
#include "../memory.h"
#include "../../cpu/sh2/compiler.h"
#include <cpu/sh2/compiler.h>
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

View file

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

View file

@ -6,8 +6,8 @@
* See COPYING file in the top-level directory.
*/
#include "../../pico_int.h"
#include "../../../cpu/drc/cmn.h"
#include <pico/pico_int.h>
#include <cpu/drc/cmn.h>
#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 <cpu/drc/emit_arm.c>
// -----------------------------------------------------

View file

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

View file

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

View file

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

View file

@ -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)

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 */
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)
{
unsigned char *base;
unsigned int asrc, a2;
u32 asrc, a2;
u16 *r;
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.
@*
#include "../arm_features.h"
#include "../pico_int_offs.h"
#include <pico/arm_features.h>
#include <pico/pico_int_offs.h>
.equiv PCM_STEP_SHIFT, 11

View file

@ -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];

View file

@ -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)

View file

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

View file

@ -11,6 +11,7 @@
#define PICO_INTERNAL_INCLUDED
#include <stdio.h>
#include <string.h>
#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 <cpu/cyclone/Cyclone.h>
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 <cpu/fame/fame.h>
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 <cpu/musashi/m68kcpu.h>
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 <cpu/DrZ80/drz80.h>
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 <cpu/cz80/cz80.h>
#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 <cpu/sh2/sh2.h>
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);

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 */
#ifdef EMU_C68K
#include "cpu/cyclone/tools/idle.h"
#include <cpu/cyclone/tools/idle.h>
#endif
static unsigned short **idledet_ptrs = NULL;

View file

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

View file

@ -6,16 +6,16 @@
#define _H_FM_FM_
/* compiler dependence */
#include <stdint.h>
#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 <platform/gp2x/940ctl.h>
#define YM2612Init(baseclock,rate,ssg) do { \
if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, ssg); \
else YM2612Init_(baseclock, rate, ssg); \

View file

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

View file

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