mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-14 06:45:09 +01:00
commit
d12d072ef9
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
psp2/*.o
|
||||||
|
psp2/*.elf
|
||||||
|
psp2/*.velf
|
||||||
|
psp2/build_vita/*
|
||||||
|
psp2/*.a
|
@ -3,7 +3,7 @@
|
|||||||
Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
||||||
---------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
[Core/General]
|
[Core/Misc]
|
||||||
---------------
|
---------------
|
||||||
* added optional dynamic allocation of cartridge/CD hardware buffer (for platforms with BSS size limitation)
|
* added optional dynamic allocation of cartridge/CD hardware buffer (for platforms with BSS size limitation)
|
||||||
* improved frame emulation timing, now starts with vertical blanking to reduce input lag by one more frame
|
* improved frame emulation timing, now starts with vertical blanking to reduce input lag by one more frame
|
||||||
@ -40,6 +40,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
|||||||
* added support for some new unlicensed games with copy protection (Thunderbolt II, Tom Clown, Chaoji Puke / Super Poker)
|
* added support for some new unlicensed games with copy protection (Thunderbolt II, Tom Clown, Chaoji Puke / Super Poker)
|
||||||
* added support for Everdrive extended SSF mapper
|
* added support for Everdrive extended SSF mapper
|
||||||
* improved console region auto-detection for a few PAL-only games (The Smurfs Travel the World & Williams Arcade's Greatest Hits)
|
* improved console region auto-detection for a few PAL-only games (The Smurfs Travel the World & Williams Arcade's Greatest Hits)
|
||||||
|
* improved I2C EEPROM boards emulation accuracy
|
||||||
* fixed Game Genie / Pro Action Replay lock-on support when Mega CD hardware is enabled
|
* fixed Game Genie / Pro Action Replay lock-on support when Mega CD hardware is enabled
|
||||||
* fixed SRAM support in Triple Play 96 & Triple Play - Gold Edition
|
* fixed SRAM support in Triple Play 96 & Triple Play - Gold Edition
|
||||||
* fixed automatic CD loading with .md ROM files
|
* fixed automatic CD loading with .md ROM files
|
||||||
@ -80,6 +81,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
|||||||
* added support for XE-1AP controller on both ports
|
* added support for XE-1AP controller on both ports
|
||||||
* improved XE-1AP controller emulation
|
* improved XE-1AP controller emulation
|
||||||
* improved HVC latch behavior for gun emulation (fixes "Gunfight - 3 in 1" randomization when using Justifier)
|
* improved HVC latch behavior for gun emulation (fixes "Gunfight - 3 in 1" randomization when using Justifier)
|
||||||
|
* improved control pad emulation accuracy (verified on real hardware)
|
||||||
* fixed TeamPlayer emulation (fixes multitap detection in Gauntlet 4)
|
* fixed TeamPlayer emulation (fixes multitap detection in Gauntlet 4)
|
||||||
|
|
||||||
[Core/VDP]
|
[Core/VDP]
|
||||||
@ -136,6 +138,10 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke)
|
|||||||
---------------
|
---------------
|
||||||
* added GCW Zero port by Shin-NiL & David Knight (based on SDL port)
|
* added GCW Zero port by Shin-NiL & David Knight (based on SDL port)
|
||||||
|
|
||||||
|
[PSP2]
|
||||||
|
---------------
|
||||||
|
* added PS VITA port by frangarcj
|
||||||
|
|
||||||
[libretro]
|
[libretro]
|
||||||
---------------
|
---------------
|
||||||
* added optional bootrom support for Master System, Game Gear & Mega Drive / Genesis
|
* added optional bootrom support for Master System, Game Gear & Mega Drive / Genesis
|
||||||
|
@ -27,7 +27,7 @@ INCLUDES := core core/m68k core/z80 core/sound core/tremor core/ntsc core/input_
|
|||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
CFLAGS = -O3 -fomit-frame-pointer --param large-function-growth=800 --param inline-unit-growth=200 -Wall -Winline -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_LIBTREMOR -DDISABLE_MANY_OGG_OPEN_FILES -DUSE_16BPP_RENDERING -DALT_RENDERER
|
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_LIBTREMOR -DDISABLE_MANY_OGG_OPEN_FILES -DUSE_16BPP_RENDERING -DALT_RENDERER
|
||||||
CXXFLAGS = $(CFLAGS)
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||||
|
@ -27,7 +27,7 @@ INCLUDES := core core/m68k core/z80 core/sound core/tremor core/ntsc core/input_
|
|||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
CFLAGS = -O3 -fomit-frame-pointer --param large-function-growth=800 --param inline-unit-growth=200 -Wall -Winline -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_LIBTREMOR -DUSE_16BPP_RENDERING -DALT_RENDERER -DHW_RVL
|
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing $(MACHDEP) $(INCLUDE) -DUSE_LIBTREMOR -DUSE_16BPP_RENDERING -DALT_RENDERER -DHW_RVL
|
||||||
CXXFLAGS = $(CFLAGS)
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map,-wrap,wiiuse_set_ir,-wrap,wiiuse_handshake,-wrap,classic_ctrl_handshake,-wrap,classic_ctrl_event
|
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map,-wrap,wiiuse_set_ir,-wrap,wiiuse_handshake,-wrap,classic_ctrl_handshake,-wrap,classic_ctrl_event
|
||||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.2 MiB |
Binary file not shown.
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.3 MiB |
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* I2C Serial EEPROM (24Cxx) support
|
* I2C Serial EEPROM (24Cxx) boards
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
@ -321,6 +321,9 @@ void md_cart_init(void)
|
|||||||
/* ROM is mirrored each 2^k bytes */
|
/* ROM is mirrored each 2^k bytes */
|
||||||
cart.mask = size - 1;
|
cart.mask = size - 1;
|
||||||
|
|
||||||
|
/* no special external hardware required by default */
|
||||||
|
cart.special = 0;
|
||||||
|
|
||||||
/**********************************************
|
/**********************************************
|
||||||
DEFAULT CARTRIDGE MAPPING
|
DEFAULT CARTRIDGE MAPPING
|
||||||
***********************************************/
|
***********************************************/
|
||||||
@ -375,7 +378,7 @@ void md_cart_init(void)
|
|||||||
/* external SRAM */
|
/* external SRAM */
|
||||||
if (sram.on && !sram.custom)
|
if (sram.on && !sram.custom)
|
||||||
{
|
{
|
||||||
/* initialize m68k bus handlers */
|
/* initialize default memory mapping for SRAM */
|
||||||
m68k.memory_map[sram.start >> 16].base = sram.sram;
|
m68k.memory_map[sram.start >> 16].base = sram.sram;
|
||||||
m68k.memory_map[sram.start >> 16].read8 = sram_read_byte;
|
m68k.memory_map[sram.start >> 16].read8 = sram_read_byte;
|
||||||
m68k.memory_map[sram.start >> 16].read16 = sram_read_word;
|
m68k.memory_map[sram.start >> 16].read16 = sram_read_word;
|
||||||
@ -405,38 +408,6 @@ void md_cart_init(void)
|
|||||||
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
|
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************
|
|
||||||
J-CART
|
|
||||||
***********************************************/
|
|
||||||
cart.special = 0;
|
|
||||||
if ((strstr(rominfo.product,"00000000") && (rominfo.checksum == 0x168b)) || /* Super Skidmarks, Micro Machines Military */
|
|
||||||
(strstr(rominfo.product,"00000000") && (rominfo.checksum == 0x165e)) || /* Pete Sampras Tennis (1991), Micro Machines 96 */
|
|
||||||
(strstr(rominfo.product,"00000000") && (rominfo.checksum == 0xcee0)) || /* Micro Machines Military (bad) */
|
|
||||||
(strstr(rominfo.product,"00000000") && (rominfo.checksum == 0x2c41)) || /* Micro Machines 96 (bad) */
|
|
||||||
(strstr(rominfo.product,"XXXXXXXX") && (rominfo.checksum == 0xdf39)) || /* Sampras Tennis 96 */
|
|
||||||
(strstr(rominfo.product,"T-123456") && (rominfo.checksum == 0x1eae)) || /* Sampras Tennis 96 */
|
|
||||||
(strstr(rominfo.product,"T-120066") && (rominfo.checksum == 0x16a4)) || /* Pete Sampras Tennis (1994)*/
|
|
||||||
strstr(rominfo.product,"T-120096")) /* Micro Machines 2 */
|
|
||||||
{
|
|
||||||
if (cart.romsize <= 0x380000) /* just to be sure (checksum might not be enough) */
|
|
||||||
{
|
|
||||||
cart.special |= HW_J_CART;
|
|
||||||
|
|
||||||
/* force port 1 setting */
|
|
||||||
if (input.system[1] != SYSTEM_WAYPLAY)
|
|
||||||
{
|
|
||||||
old_system[1] = input.system[1];
|
|
||||||
input.system[1] = SYSTEM_GAMEPAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* extra connectors mapped at $38xxxx or $3Fxxxx */
|
|
||||||
m68k.memory_map[0x38].read16 = jcart_read;
|
|
||||||
m68k.memory_map[0x38].write16 = jcart_write;
|
|
||||||
m68k.memory_map[0x3f].read16 = jcart_read;
|
|
||||||
m68k.memory_map[0x3f].write16 = jcart_write;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************
|
/**********************************************
|
||||||
LOCK-ON
|
LOCK-ON
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* 2-Buttons, 3-Buttons & 6-Buttons controller support
|
* 2-Buttons, 3-Buttons & 6-Buttons controller support
|
||||||
* Additional support for J-Cart, 4-Way Play & Master Tap adapters
|
* with support for J-Cart, 4-Way Play & Master Tap adapters
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -45,6 +45,7 @@ static struct
|
|||||||
uint8 State;
|
uint8 State;
|
||||||
uint8 Counter;
|
uint8 Counter;
|
||||||
uint8 Timeout;
|
uint8 Timeout;
|
||||||
|
uint32 Latency;
|
||||||
} gamepad[MAX_DEVICES];
|
} gamepad[MAX_DEVICES];
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
@ -62,6 +63,7 @@ void gamepad_reset(int port)
|
|||||||
gamepad[port].State = 0x40;
|
gamepad[port].State = 0x40;
|
||||||
gamepad[port].Counter = 0;
|
gamepad[port].Counter = 0;
|
||||||
gamepad[port].Timeout = 0;
|
gamepad[port].Timeout = 0;
|
||||||
|
gamepad[port].Latency = 0;
|
||||||
|
|
||||||
/* reset 4-WayPlay latch */
|
/* reset 4-WayPlay latch */
|
||||||
latch = 0;
|
latch = 0;
|
||||||
@ -81,17 +83,43 @@ void gamepad_refresh(int port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gamepad_end_frame(int port, unsigned int cycles)
|
||||||
|
{
|
||||||
|
if (gamepad[port].Latency > cycles)
|
||||||
|
{
|
||||||
|
/* adjust TH direction switching latency for next frame */
|
||||||
|
gamepad[port].Latency -= cycles;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* reset TH direction switching latency */
|
||||||
|
gamepad[port].Latency = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
INLINE unsigned char gamepad_read(int port)
|
INLINE unsigned char gamepad_read(int port)
|
||||||
{
|
{
|
||||||
/* bit 7 is latched, returns current TH state */
|
/* D7 is not connected, D6 returns TH input state */
|
||||||
unsigned int data = (gamepad[port].State & 0x40) | 0x3F;
|
unsigned int data = gamepad[port].State | 0x3F;
|
||||||
|
|
||||||
/* pad value */
|
/* pad state */
|
||||||
unsigned int val = input.pad[port];
|
unsigned int pad = input.pad[port];
|
||||||
|
|
||||||
/* get current step (TH state) */
|
/* get current TH input pulse counter */
|
||||||
unsigned int step = gamepad[port].Counter | ((data >> 6) & 1);
|
unsigned int step = gamepad[port].Counter | (data >> 6);
|
||||||
|
|
||||||
|
/* get current timestamp */
|
||||||
|
unsigned int cycles = ((system_hw & SYSTEM_PBC) == SYSTEM_MD) ? m68k.cycles : Z80.cycles;
|
||||||
|
|
||||||
|
/* TH direction switching latency */
|
||||||
|
if (cycles < gamepad[port].Latency)
|
||||||
|
{
|
||||||
|
/* TH internal state switching has not occured yet (Decap Attack) */
|
||||||
|
step &= ~1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* C/B or START/A buttons status is returned on D5-D4 (active low) */
|
||||||
|
/* D-PAD or extra buttons status is returned on D3-D0 (active low) */
|
||||||
switch (step)
|
switch (step)
|
||||||
{
|
{
|
||||||
case 1: /*** First High ***/
|
case 1: /*** First High ***/
|
||||||
@ -99,54 +127,58 @@ INLINE unsigned char gamepad_read(int port)
|
|||||||
case 5: /*** Third High ***/
|
case 5: /*** Third High ***/
|
||||||
{
|
{
|
||||||
/* TH = 1 : ?1CBRLDU */
|
/* TH = 1 : ?1CBRLDU */
|
||||||
data &= ~(val & 0x3F);
|
data &= ~(pad & 0x3F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0: /*** First low ***/
|
case 0: /*** 3-button only ***/
|
||||||
case 2: /*** Second low ***/
|
case 2: /*** First Low ***/
|
||||||
|
case 4: /*** Second Low ***/
|
||||||
{
|
{
|
||||||
/* TH = 0 : ?0SA00DU */
|
/* TH = 0 : ?0SA00DU */
|
||||||
data &= ~(val & 0x03);
|
data &= ~((pad & 0x03) | ((pad >> 2) & 0x30) | 0x0C);
|
||||||
data &= ~((val >> 2) & 0x30);
|
|
||||||
data &= ~0x0C;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 6buttons specific (taken from gen-hw.txt) */
|
|
||||||
/* A 6-button gamepad allows the extra buttons to be read based on how */
|
/* A 6-button gamepad allows the extra buttons to be read based on how */
|
||||||
/* many times TH is switched from 1 to 0 (and not 0 to 1). Observe the */
|
/* many times TH is switched from 1 to 0. Observe the following sequence */
|
||||||
/* following sequence */
|
|
||||||
/*
|
/*
|
||||||
TH = 1 : ?1CBRLDU 3-button pad return value
|
TH = 1 : ?1CBRLDU 3-button pad return value
|
||||||
TH = 0 : ?0SA00DU 3-button pad return value
|
TH = 0 : ?0SA00DU 3-button pad return value
|
||||||
TH = 1 : ?1CBRLDU 3-button pad return value
|
TH = 1 : ?1CBRLDU 3-button pad return value
|
||||||
TH = 0 : ?0SA0000 D3-0 are forced to '0'
|
TH = 0 : ?0SA00DU 3-button pad return value
|
||||||
|
TH = 1 : ?1CBRLDU 3-button pad return value
|
||||||
|
TH = 0 : ?0SA0000 D3-D0 are forced to '0'
|
||||||
TH = 1 : ?1CBMXYZ Extra buttons returned in D3-0
|
TH = 1 : ?1CBMXYZ Extra buttons returned in D3-0
|
||||||
TH = 0 : ?0SA1111 D3-0 are forced to '1'
|
TH = 0 : ?0SA1111 D3-D0 are forced to '1'
|
||||||
*/
|
*/
|
||||||
case 4: /*** Third Low ***/
|
case 6: /*** Third Low ***/
|
||||||
{
|
{
|
||||||
/* TH = 0 : ?0SA0000 D3-0 are forced to '0'*/
|
/* TH = 0 : ?0SA0000 D3-D0 forced to '0' */
|
||||||
data &= ~((val >> 2) & 0x30);
|
data &= ~(((pad >> 2) & 0x30) | 0x0F);
|
||||||
data &= ~0x0F;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 6: /*** Fourth Low ***/
|
|
||||||
{
|
|
||||||
/* TH = 0 : ?0SA1111 D3-0 are forced to '1'*/
|
|
||||||
data &= ~((val >> 2) & 0x30);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 7: /*** Fourth High ***/
|
case 7: /*** Fourth High ***/
|
||||||
{
|
{
|
||||||
/* TH = 1 : ?1CBMXYZ Extra buttons returned in D3-0*/
|
/* TH = 1 : ?1CBMXYZ Extra buttons returned in D3-D0 */
|
||||||
data &= ~(val & 0x30);
|
data &= ~((pad & 0x30) | ((pad >> 8) & 0x0F));
|
||||||
data &= ~((val >> 8) & 0x0F);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default: /*** D3-D0 forced to '1' ***/
|
||||||
|
{
|
||||||
|
if (data & 0x40)
|
||||||
|
{
|
||||||
|
/* TH = 1 : ?0CB1111 */
|
||||||
|
data &= ~(pad & 0x30);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* TH = 0 : ?0SA1111 */
|
||||||
|
data &= ~((pad >> 2) & 0x30);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@ -154,24 +186,45 @@ INLINE unsigned char gamepad_read(int port)
|
|||||||
|
|
||||||
INLINE void gamepad_write(int port, unsigned char data, unsigned char mask)
|
INLINE void gamepad_write(int port, unsigned char data, unsigned char mask)
|
||||||
{
|
{
|
||||||
/* update bits set as output only */
|
/* Check TH pin direction */
|
||||||
data = (gamepad[port].State & ~mask) | (data & mask);
|
if (mask & 0x40)
|
||||||
|
|
||||||
if (input.dev[port] == DEVICE_PAD6B)
|
|
||||||
{
|
{
|
||||||
/* TH=0 to TH=1 transition */
|
/* get TH output state */
|
||||||
if (!(gamepad[port].State & 0x40) && (data & 0x40))
|
data &= 0x40;
|
||||||
|
|
||||||
|
/* reset TH direction switching latency */
|
||||||
|
gamepad[port].Latency = 0;
|
||||||
|
|
||||||
|
/* 6-Buttons controller specific */
|
||||||
|
if (input.dev[port] == DEVICE_PAD6B)
|
||||||
{
|
{
|
||||||
gamepad[port].Counter = (gamepad[port].Counter + 2) & 6;
|
/* TH 1->0 transition */
|
||||||
gamepad[port].Timeout = 0;
|
if (!data && gamepad[port].State)
|
||||||
|
{
|
||||||
|
gamepad[port].Counter += 2;
|
||||||
|
gamepad[port].Timeout = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* retrieve current timestamp */
|
||||||
|
unsigned int cycles = ((system_hw & SYSTEM_PBC) == SYSTEM_MD) ? m68k.cycles : Z80.cycles;
|
||||||
|
|
||||||
|
/* TH is pulled high when not configured as output by I/O controller output */
|
||||||
|
data = 0x40;
|
||||||
|
|
||||||
|
/* TH 0->1 internal switching does not occur immediately (verified on MK-1650 model) */
|
||||||
|
if (!gamepad[port].State)
|
||||||
|
{
|
||||||
|
gamepad[port].Latency = cycles + 172;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update internal state */
|
/* update TH input state */
|
||||||
gamepad[port].State = data;
|
gamepad[port].State = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
/* Default ports handlers */
|
/* Default ports handlers */
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -206,7 +259,7 @@ unsigned char wayplay_1_read(void)
|
|||||||
if (latch & 0x04)
|
if (latch & 0x04)
|
||||||
{
|
{
|
||||||
/* 4-WayPlay detection : xxxxx00 */
|
/* 4-WayPlay detection : xxxxx00 */
|
||||||
return 0x7c;
|
return 0x7C;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TR & TL on port B select controller # (0-3) */
|
/* TR & TL on port B select controller # (0-3) */
|
||||||
@ -237,15 +290,15 @@ void wayplay_2_write(unsigned char data, unsigned char mask)
|
|||||||
|
|
||||||
unsigned int jcart_read(unsigned int address)
|
unsigned int jcart_read(unsigned int address)
|
||||||
{
|
{
|
||||||
/* TH2 output read is fixed to zero (fixes Micro Machines 2) */
|
/* D6 returns TH state, D14 is fixed low (fixes Micro Machines 2) */
|
||||||
return ((gamepad_read(5) & 0x7F) | ((gamepad_read(6) & 0x3F) << 8));
|
return (gamepad_read(5) | ((gamepad_read(6) & 0x3F) << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
void jcart_write(unsigned int address, unsigned int data)
|
void jcart_write(unsigned int address, unsigned int data)
|
||||||
{
|
{
|
||||||
gamepad_write(5, (data & 1) << 6, 0x40);
|
data = (data & 0x01) << 6;
|
||||||
gamepad_write(6, (data & 1) << 6, 0x40);
|
gamepad_write(5, data, 0x40);
|
||||||
return;
|
gamepad_write(6, data, 0x40);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -283,7 +336,7 @@ void mastertap_2_write(unsigned char data, unsigned char mask)
|
|||||||
/* update bits set as output only */
|
/* update bits set as output only */
|
||||||
data = (flipflop[1].Latch & ~mask) | (data & mask);
|
data = (flipflop[1].Latch & ~mask) | (data & mask);
|
||||||
|
|
||||||
/* check TH=1 to TH=0 transition */
|
/* check TH 1->0 transition */
|
||||||
if ((flipflop[1].Latch & 0x40) && !(data & 0x40))
|
if ((flipflop[1].Latch & 0x40) && !(data & 0x40))
|
||||||
{
|
{
|
||||||
flipflop[1].Counter = (flipflop[1].Counter + 1) & 0x03;
|
flipflop[1].Counter = (flipflop[1].Counter + 1) & 0x03;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* 2-Buttons, 3-Buttons & 6-Buttons controller support
|
* 2-Buttons, 3-Buttons & 6-Buttons controller support
|
||||||
* Additional support for J-Cart, 4-Way Play & Master Tap adapters
|
* with support for J-Cart, 4-Way Play & Master Tap adapters
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -43,6 +43,7 @@
|
|||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
extern void gamepad_reset(int port);
|
extern void gamepad_reset(int port);
|
||||||
extern void gamepad_refresh(int port);
|
extern void gamepad_refresh(int port);
|
||||||
|
extern void gamepad_end_frame(int port, unsigned int cycles);
|
||||||
extern unsigned char gamepad_1_read(void);
|
extern unsigned char gamepad_1_read(void);
|
||||||
extern unsigned char gamepad_2_read(void);
|
extern unsigned char gamepad_2_read(void);
|
||||||
extern void gamepad_1_write(unsigned char data, unsigned char mask);
|
extern void gamepad_1_write(unsigned char data, unsigned char mask);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Input peripherals support
|
* Input peripherals support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -464,3 +464,20 @@ void input_refresh(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void input_end_frame(unsigned int cycles)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; i<MAX_DEVICES; i++)
|
||||||
|
{
|
||||||
|
switch (input.dev[i])
|
||||||
|
{
|
||||||
|
case DEVICE_PAD3B:
|
||||||
|
case DEVICE_PAD6B:
|
||||||
|
{
|
||||||
|
gamepad_end_frame(i, cycles);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@
|
|||||||
* Input peripherals support
|
* Input peripherals support
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -154,5 +154,6 @@ extern int old_system[2];
|
|||||||
extern void input_init(void);
|
extern void input_init(void);
|
||||||
extern void input_reset(void);
|
extern void input_reset(void);
|
||||||
extern void input_refresh(void);
|
extern void input_refresh(void);
|
||||||
|
extern void input_end_frame(unsigned int cycles);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -725,8 +725,8 @@ int load_rom(char *filename)
|
|||||||
system_bios = (system_bios & 0xf0) | (region_code >> 4);
|
system_bios = (system_bios & 0xf0) | (region_code >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ROM cartridge with CD loaded */
|
/* ROM cartridge (max. 8MB) with CD loaded */
|
||||||
else if (cdd.loaded)
|
else if ((cart.romsize <= 0x800000) && cdd.loaded)
|
||||||
{
|
{
|
||||||
/* try to load CD BOOTROM */
|
/* try to load CD BOOTROM */
|
||||||
if (load_bios(SYSTEM_MCD))
|
if (load_bios(SYSTEM_MCD))
|
||||||
|
@ -40,7 +40,9 @@
|
|||||||
#ifndef _LOADROM_H_
|
#ifndef _LOADROM_H_
|
||||||
#define _LOADROM_H_
|
#define _LOADROM_H_
|
||||||
|
|
||||||
|
#ifndef MAXROMSIZE
|
||||||
#define MAXROMSIZE 10485760
|
#define MAXROMSIZE 10485760
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,7 @@ void m68k_run(unsigned int cycles)
|
|||||||
REG_IR = m68ki_read_imm_16();
|
REG_IR = m68ki_read_imm_16();
|
||||||
|
|
||||||
/* Execute instruction */
|
/* Execute instruction */
|
||||||
m68ki_instruction_jump_table[REG_IR]();
|
m68ki_instruction_jump_table[REG_IR]();
|
||||||
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
|
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
|
||||||
|
|
||||||
/* Trace m68k_exception, if necessary */
|
/* Trace m68k_exception, if necessary */
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Virtual System emulation
|
* Virtual System emulation
|
||||||
*
|
*
|
||||||
* Support for "Genesis", "Genesis + CD" & "Master System" modes
|
* Support for 16-bit & 8-bit hardware modes
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -353,9 +353,6 @@ void system_frame_gen(int do_skip)
|
|||||||
/* line counters */
|
/* line counters */
|
||||||
int start, end, line;
|
int start, end, line;
|
||||||
|
|
||||||
/* Z80 interrupt flag */
|
|
||||||
int zirq = 1;
|
|
||||||
|
|
||||||
/* reset frame cycle counter */
|
/* reset frame cycle counter */
|
||||||
mcycles_vdp = 0;
|
mcycles_vdp = 0;
|
||||||
|
|
||||||
@ -551,9 +548,9 @@ void system_frame_gen(int do_skip)
|
|||||||
/* update 6-Buttons & Lightguns */
|
/* update 6-Buttons & Lightguns */
|
||||||
input_refresh();
|
input_refresh();
|
||||||
|
|
||||||
if (zirq)
|
if (Z80.irq_state)
|
||||||
{
|
{
|
||||||
/* Z80 interrupt is asserted exactly for one line */
|
/* Z80 interrupt is asserted for exactly one line */
|
||||||
m68k_run(mcycles_vdp + 788);
|
m68k_run(mcycles_vdp + 788);
|
||||||
if (zstate == 1)
|
if (zstate == 1)
|
||||||
{
|
{
|
||||||
@ -566,7 +563,6 @@ void system_frame_gen(int do_skip)
|
|||||||
|
|
||||||
/* clear Z80 interrupt */
|
/* clear Z80 interrupt */
|
||||||
Z80.irq_state = CLEAR_LINE;
|
Z80.irq_state = CLEAR_LINE;
|
||||||
zirq = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run 68k & Z80 until end of line */
|
/* run 68k & Z80 until end of line */
|
||||||
@ -714,7 +710,8 @@ void system_frame_gen(int do_skip)
|
|||||||
bitmap.viewport.changed |= 1;
|
bitmap.viewport.changed |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adjust CPU cycle counters for next frame */
|
/* adjust timings for next frame */
|
||||||
|
input_end_frame(mcycles_vdp);
|
||||||
m68k.cycles -= mcycles_vdp;
|
m68k.cycles -= mcycles_vdp;
|
||||||
Z80.cycles -= mcycles_vdp;
|
Z80.cycles -= mcycles_vdp;
|
||||||
}
|
}
|
||||||
@ -724,9 +721,6 @@ void system_frame_scd(int do_skip)
|
|||||||
/* line counters */
|
/* line counters */
|
||||||
int start, end, line;
|
int start, end, line;
|
||||||
|
|
||||||
/* Z80 interrupt flag */
|
|
||||||
int zirq = 1;
|
|
||||||
|
|
||||||
/* reset frame cycle counter */
|
/* reset frame cycle counter */
|
||||||
mcycles_vdp = 0;
|
mcycles_vdp = 0;
|
||||||
scd.cycles = 0;
|
scd.cycles = 0;
|
||||||
@ -881,7 +875,7 @@ void system_frame_scd(int do_skip)
|
|||||||
/* assert Z80 interrupt */
|
/* assert Z80 interrupt */
|
||||||
Z80.irq_state = ASSERT_LINE;
|
Z80.irq_state = ASSERT_LINE;
|
||||||
|
|
||||||
/* run both 68k & CD hardware */
|
/* run both 68k & CD hardware until end of line */
|
||||||
scd_update(MCYCLES_PER_LINE);
|
scd_update(MCYCLES_PER_LINE);
|
||||||
|
|
||||||
/* run Z80 until end of line */
|
/* run Z80 until end of line */
|
||||||
@ -919,9 +913,9 @@ void system_frame_scd(int do_skip)
|
|||||||
/* update 6-Buttons & Lightguns */
|
/* update 6-Buttons & Lightguns */
|
||||||
input_refresh();
|
input_refresh();
|
||||||
|
|
||||||
if (zirq)
|
if (Z80.irq_state)
|
||||||
{
|
{
|
||||||
/* Z80 interrupt is asserted exactly for one line */
|
/* Z80 interrupt is asserted for exactly one line */
|
||||||
m68k_run(mcycles_vdp + 788);
|
m68k_run(mcycles_vdp + 788);
|
||||||
if (zstate == 1)
|
if (zstate == 1)
|
||||||
{
|
{
|
||||||
@ -934,10 +928,9 @@ void system_frame_scd(int do_skip)
|
|||||||
|
|
||||||
/* clear Z80 interrupt */
|
/* clear Z80 interrupt */
|
||||||
Z80.irq_state = CLEAR_LINE;
|
Z80.irq_state = CLEAR_LINE;
|
||||||
zirq = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run both 68k & CD hardware */
|
/* run both 68k & CD hardware until end of line */
|
||||||
scd_update(mcycles_vdp + MCYCLES_PER_LINE);
|
scd_update(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
|
|
||||||
/* run Z80 until end of line */
|
/* run Z80 until end of line */
|
||||||
@ -985,7 +978,7 @@ void system_frame_scd(int do_skip)
|
|||||||
/* update 6-Buttons & Lightguns */
|
/* update 6-Buttons & Lightguns */
|
||||||
input_refresh();
|
input_refresh();
|
||||||
|
|
||||||
/* run both 68k & CD hardware */
|
/* run both 68k & CD hardware until end of line */
|
||||||
scd_update(mcycles_vdp + MCYCLES_PER_LINE);
|
scd_update(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
|
|
||||||
/* run Z80 until end of line */
|
/* run Z80 until end of line */
|
||||||
@ -1045,7 +1038,7 @@ void system_frame_scd(int do_skip)
|
|||||||
h_counter--;
|
h_counter--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run both 68k & CD hardware */
|
/* run both 68k & CD hardware until end of line */
|
||||||
scd_update(mcycles_vdp + MCYCLES_PER_LINE);
|
scd_update(mcycles_vdp + MCYCLES_PER_LINE);
|
||||||
|
|
||||||
/* run Z80 until end of line */
|
/* run Z80 until end of line */
|
||||||
@ -1070,10 +1063,9 @@ void system_frame_scd(int do_skip)
|
|||||||
bitmap.viewport.changed |= 1;
|
bitmap.viewport.changed |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prepare for next SCD frame */
|
/* adjust timings for next frame */
|
||||||
scd_end_frame(scd.cycles);
|
scd_end_frame(scd.cycles);
|
||||||
|
input_end_frame(mcycles_vdp);
|
||||||
/* adjust CPU cycle counters for next frame */
|
|
||||||
m68k.cycles -= mcycles_vdp;
|
m68k.cycles -= mcycles_vdp;
|
||||||
Z80.cycles -= mcycles_vdp;
|
Z80.cycles -= mcycles_vdp;
|
||||||
}
|
}
|
||||||
@ -1465,6 +1457,7 @@ void system_frame_sms(int do_skip)
|
|||||||
bitmap.viewport.changed |= 1;
|
bitmap.viewport.changed |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adjust Z80 cycle count for next frame */
|
/* adjust timings for next frame */
|
||||||
|
input_end_frame(mcycles_vdp);
|
||||||
Z80.cycles -= mcycles_vdp;
|
Z80.cycles -= mcycles_vdp;
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* Genesis Plus
|
* Genesis Plus
|
||||||
* Virtual System emulation
|
* Virtual System emulation
|
||||||
*
|
*
|
||||||
* Support for "Genesis", "Genesis + CD" & "Master System" modes
|
* Support for 16-bit & 8-bit hardware modes
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
|
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
|
||||||
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
|
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
@ -210,7 +210,7 @@ ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
|
|||||||
int indexdiv=1;
|
int indexdiv=1;
|
||||||
for(k=0;k<b->dim;k++){
|
for(k=0;k<b->dim;k++){
|
||||||
int index= (j/indexdiv)%quantvals;
|
int index= (j/indexdiv)%quantvals;
|
||||||
int point=0;
|
ogg_int32_t point=0;
|
||||||
int val=VFLOAT_MULTI(delta,delpoint,
|
int val=VFLOAT_MULTI(delta,delpoint,
|
||||||
abs(b->quantlist[index]),&point);
|
abs(b->quantlist[index]),&point);
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
|
|||||||
int lastpoint=0;
|
int lastpoint=0;
|
||||||
|
|
||||||
for(k=0;k<b->dim;k++){
|
for(k=0;k<b->dim;k++){
|
||||||
int point=0;
|
ogg_int32_t point=0;
|
||||||
int val=VFLOAT_MULTI(delta,delpoint,
|
int val=VFLOAT_MULTI(delta,delpoint,
|
||||||
abs(b->quantlist[j*b->dim+k]),&point);
|
abs(b->quantlist[j*b->dim+k]),&point);
|
||||||
|
|
||||||
@ -436,4 +436,3 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||||||
vorbis_book_clear(c);
|
vorbis_book_clear(c);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,8 +470,11 @@ INLINE void WRITE_LONG(void *address, uint32 data)
|
|||||||
|
|
||||||
/* 5:5:5 RGB */
|
/* 5:5:5 RGB */
|
||||||
#elif defined(USE_15BPP_RENDERING)
|
#elif defined(USE_15BPP_RENDERING)
|
||||||
|
#if defined(USE_ABGR)
|
||||||
|
#define MAKE_PIXEL(r,g,b) ((1 << 15) | (b) << 11 | ((b) >> 3) << 10 | (g) << 6 | ((g) >> 3) << 5 | (r) << 1 | (r) >> 3)
|
||||||
|
#else
|
||||||
#define MAKE_PIXEL(r,g,b) ((1 << 15) | (r) << 11 | ((r) >> 3) << 10 | (g) << 6 | ((g) >> 3) << 5 | (b) << 1 | (b) >> 3)
|
#define MAKE_PIXEL(r,g,b) ((1 << 15) | (r) << 11 | ((r) >> 3) << 10 | (g) << 6 | ((g) >> 3) << 5 | (b) << 1 | (b) >> 3)
|
||||||
|
#endif
|
||||||
/* 5:6:5 RGB */
|
/* 5:6:5 RGB */
|
||||||
#elif defined(USE_16BPP_RENDERING)
|
#elif defined(USE_16BPP_RENDERING)
|
||||||
#define MAKE_PIXEL(r,g,b) ((r) << 12 | ((r) >> 3) << 11 | (g) << 7 | ((g) >> 2) << 5 | (b) << 1 | (b) >> 3)
|
#define MAKE_PIXEL(r,g,b) ((r) << 12 | ((r) >> 3) << 11 | (g) << 7 | ((g) >> 2) << 5 | (b) << 1 | (b) >> 3)
|
||||||
|
@ -51,10 +51,17 @@
|
|||||||
|
|
||||||
/* 5:5:5 RGB */
|
/* 5:5:5 RGB */
|
||||||
#elif defined(USE_15BPP_RENDERING)
|
#elif defined(USE_15BPP_RENDERING)
|
||||||
|
#if defined(USE_ABGR)
|
||||||
|
#define PIXEL(r,g,b) ((1 << 15) | ((b) << 10) | ((g) << 5) | (r))
|
||||||
|
#define GET_B(pixel) (((pixel) & 0x7c00) >> 10)
|
||||||
|
#define GET_G(pixel) (((pixel) & 0x03e0) >> 5)
|
||||||
|
#define GET_R(pixel) (((pixel) & 0x001f) >> 0)
|
||||||
|
#else
|
||||||
#define PIXEL(r,g,b) ((1 << 15) | ((r) << 10) | ((g) << 5) | (b))
|
#define PIXEL(r,g,b) ((1 << 15) | ((r) << 10) | ((g) << 5) | (b))
|
||||||
#define GET_R(pixel) (((pixel) & 0x7c00) >> 10)
|
#define GET_R(pixel) (((pixel) & 0x7c00) >> 10)
|
||||||
#define GET_G(pixel) (((pixel) & 0x03e0) >> 5)
|
#define GET_G(pixel) (((pixel) & 0x03e0) >> 5)
|
||||||
#define GET_B(pixel) (((pixel) & 0x001f) >> 0)
|
#define GET_B(pixel) (((pixel) & 0x001f) >> 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 5:6:5 RGB */
|
/* 5:6:5 RGB */
|
||||||
#elif defined(USE_16BPP_RENDERING)
|
#elif defined(USE_16BPP_RENDERING)
|
||||||
@ -134,4 +141,3 @@ extern void (*parse_satb)(int line);
|
|||||||
extern void (*update_bg_pattern_cache)(int index);
|
extern void (*update_bg_pattern_cache)(int index);
|
||||||
|
|
||||||
#endif /* _RENDER_H_ */
|
#endif /* _RENDER_H_ */
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* IPL font engine (using GX rendering)
|
* IPL font engine (using GX rendering)
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2009-2013)
|
* Copyright Eke-Eke (2009-2015)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -213,7 +213,7 @@ static void DrawChar(unsigned char c, int xpos, int ypos, int size, GXColor colo
|
|||||||
/* reinitialize font texture data */
|
/* reinitialize font texture data */
|
||||||
memset(fontTexture,0,fontHeader->cell_width * fontHeader->cell_height / 2);
|
memset(fontTexture,0,fontHeader->cell_width * fontHeader->cell_height / 2);
|
||||||
GetFontTexel(c,fontTexture,0,fontHeader->cell_width/2);
|
GetFontTexel(c,fontTexture,0,fontHeader->cell_width/2);
|
||||||
DCFlushRange(fontTexture, fontHeader->cell_width * fontHeader->cell_height / 2);
|
DCStoreRange(fontTexture, fontHeader->cell_width * fontHeader->cell_height / 2);
|
||||||
GX_InvalidateTexAll();
|
GX_InvalidateTexAll();
|
||||||
|
|
||||||
/* adjust texture width */
|
/* adjust texture width */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* IPL font engine (using GX rendering)
|
* IPL font engine (using GX rendering)
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2009-2013)
|
* Copyright Eke-Eke (2009-2015)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX audio support
|
* Genesis Plus GX audio support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2014), based on original work from Softdev (2006)
|
* Copyright Eke-Eke (2007-2015), based on original work from Softdev (2006)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -143,7 +143,7 @@ int gx_audio_Update(int status)
|
|||||||
{
|
{
|
||||||
/* Retrieve audio samples (size must be multiple of 32 bytes) */
|
/* Retrieve audio samples (size must be multiple of 32 bytes) */
|
||||||
bufferSize = audio_update(sb) * 4;
|
bufferSize = audio_update(sb) * 4;
|
||||||
DCFlushRange((void *)sb, bufferSize);
|
DCStoreRange((void *)sb, bufferSize);
|
||||||
|
|
||||||
/* Mark current audio frame as being updated */
|
/* Mark current audio frame as being updated */
|
||||||
status &= ~AUDIO_UPDATE;
|
status &= ~AUDIO_UPDATE;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX audio support
|
* Genesis Plus GX audio support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2014), based on original work from Softdev (2006)
|
* Copyright Eke-Eke (2007-2015), based on original work from Softdev (2006)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX video & rendering support
|
* Genesis Plus GX video & rendering support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2014), based on original work from Softdev (2006)
|
* Copyright Eke-Eke (2007-2015), based on original work from Softdev (2006)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
@ -682,7 +682,7 @@ static void gxResetScaler(u32 width)
|
|||||||
square[2] = square[4] = xshift + xscale;
|
square[2] = square[4] = xshift + xscale;
|
||||||
square[1] = square[3] = yshift + yscale;
|
square[1] = square[3] = yshift + yscale;
|
||||||
square[5] = square[7] = yshift - yscale;
|
square[5] = square[7] = yshift - yscale;
|
||||||
DCFlushRange(square, 32);
|
DCStoreRange(square, 32);
|
||||||
GX_InvVtxCache();
|
GX_InvVtxCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1057,7 +1057,7 @@ void gxCopyScreenshot(gx_texture *texture)
|
|||||||
GX_LoadTexObj(&texobj, GX_TEXMAP0);
|
GX_LoadTexObj(&texobj, GX_TEXMAP0);
|
||||||
GX_InvalidateTexAll();
|
GX_InvalidateTexAll();
|
||||||
GX_Flush();
|
GX_Flush();
|
||||||
DCFlushRange(texture->data, texture->width * texture->height * 4);
|
DCStoreRange(texture->data, texture->width * texture->height * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Take Screenshot */
|
/* Take Screenshot */
|
||||||
@ -1310,8 +1310,8 @@ gx_texture *gxTextureOpenPNG(const u8 *png_data, FILE *png_file)
|
|||||||
/* release memory */
|
/* release memory */
|
||||||
free(img_data);
|
free(img_data);
|
||||||
|
|
||||||
/* flush texture data from cache */
|
/* force texture data update in memory */
|
||||||
DCFlushRange(texture->data, height * stride);
|
DCStoreRange(texture->data, height * stride);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
@ -1768,7 +1768,7 @@ int gx_video_Update(int status)
|
|||||||
/* texture is now directly mapped by the line renderer */
|
/* texture is now directly mapped by the line renderer */
|
||||||
|
|
||||||
/* force texture cache update */
|
/* force texture cache update */
|
||||||
DCFlushRange(bitmap.data, vwidth*vheight*2);
|
DCStoreRange(bitmap.data, vwidth*vheight*2);
|
||||||
GX_InvalidateTexAll();
|
GX_InvalidateTexAll();
|
||||||
|
|
||||||
/* disable EFB copy until rendering is done */
|
/* disable EFB copy until rendering is done */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Genesis Plus GX video support
|
* Genesis Plus GX video support
|
||||||
*
|
*
|
||||||
* Copyright Eke-Eke (2007-2014), based on original work from Softdev (2006)
|
* Copyright Eke-Eke (2007-2015), based on original work from Softdev (2006)
|
||||||
*
|
*
|
||||||
* Redistribution and use of this code or any derivative works are permitted
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
* provided that the following conditions are met:
|
* provided that the following conditions are met:
|
||||||
|
180
psp2/Makefile
Normal file
180
psp2/Makefile
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
|
||||||
|
# Makefile for genplus SDL
|
||||||
|
#
|
||||||
|
# (c) 1999, 2000, 2001, 2002, 2003 Charles MacDonald
|
||||||
|
# modified by Eke-Eke <eke_eke31@yahoo.fr>
|
||||||
|
#
|
||||||
|
# Defines :
|
||||||
|
# -DLSB_FIRST : for little endian systems.
|
||||||
|
# -DLOGERROR : enable message logging
|
||||||
|
# -DLOGVDP : enable VDP debug messages
|
||||||
|
# -DLOGSOUND : enable AUDIO debug messages
|
||||||
|
# -DLOG_SCD : enable SCD debug messages
|
||||||
|
# -DLOG_CDD : enable CDD debug messages
|
||||||
|
# -DLOG_CDC : enable CDC debug messages
|
||||||
|
# -DLOG_PCM : enable PCM debug messages
|
||||||
|
# -DLOGSOUND : enable AUDIO debug messages
|
||||||
|
# -D8BPP_RENDERING - configure for 8-bit pixels (RGB332)
|
||||||
|
# -D15BPP_RENDERING - configure for 15-bit pixels (RGB555)
|
||||||
|
# -D16BPP_RENDERING - configure for 16-bit pixels (RGB565)
|
||||||
|
# -D32BPP_RENDERING - configure for 32-bit pixels (RGB888)
|
||||||
|
|
||||||
|
NAME = gen_vita
|
||||||
|
PSP_APP_NAME=GENPLUSGXVITA
|
||||||
|
PSP_APP_VER=1.7.5
|
||||||
|
|
||||||
|
CC = arm-vita-eabi-gcc
|
||||||
|
CFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-strict-aliasing -ansi -std=c11 \
|
||||||
|
-pedantic-errors -fno-unwind-tables -fno-asynchronous-unwind-tables -ftree-vectorize \
|
||||||
|
-mfloat-abi=hard -ffast-math -fsingle-precision-constant -ftree-vectorizer-verbose=2 -fopt-info-vec-optimized -funroll-loops
|
||||||
|
#-g -ggdb -pg
|
||||||
|
#-fomit-frame-pointer
|
||||||
|
LDFLAGS = -Wl,-q
|
||||||
|
DEFINES = -DPSP_APP_NAME=\"$(PSP_APP_NAME)\" -DPSP_APP_VER=\"$(PSP_APP_VER)\" \
|
||||||
|
-DLSB_FIRST -DUSE_15BPP_RENDERING -DUSE_LIBTREMOR -DALT_RENDERER -DALIGN_LONG -DHAVE_ALLOCA_H -DUSE_ABGR
|
||||||
|
SRCDIR = ../core
|
||||||
|
INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/z80 -I$(SRCDIR)/m68k -I$(SRCDIR)/sound -I$(SRCDIR)/input_hw -I$(SRCDIR)/cart_hw -I$(SRCDIR)/cart_hw/svp -I$(SRCDIR)/cd_hw -I$(SRCDIR)/ntsc -I$(SRCDIR)/tremor -I$(SRCDIR)/../psp2
|
||||||
|
LIBS = -lpsplib -lvita2d -lfreetype -lpng -lz -lm -lSceDisplay_stub -lSceGxm_stub \
|
||||||
|
-lSceCtrl_stub -lSceAudio_stub -lSceRtc_stub -lScePower_stub -lSceAppUtil_stub
|
||||||
|
#-ldebugnet -lSceNet_stub -lSceNetCtl_stub
|
||||||
|
|
||||||
|
OBJDIR = ./build_vita
|
||||||
|
|
||||||
|
OBJECTS = $(OBJDIR)/z80.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/m68kcpu.o \
|
||||||
|
$(OBJDIR)/s68kcpu.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/genesis.o \
|
||||||
|
$(OBJDIR)/vdp_ctrl.o \
|
||||||
|
$(OBJDIR)/vdp_render.o \
|
||||||
|
$(OBJDIR)/system.o \
|
||||||
|
$(OBJDIR)/io_ctrl.o \
|
||||||
|
$(OBJDIR)/mem68k.o \
|
||||||
|
$(OBJDIR)/memz80.o \
|
||||||
|
$(OBJDIR)/membnk.o \
|
||||||
|
$(OBJDIR)/state.o \
|
||||||
|
$(OBJDIR)/loadrom.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/input.o \
|
||||||
|
$(OBJDIR)/gamepad.o \
|
||||||
|
$(OBJDIR)/lightgun.o \
|
||||||
|
$(OBJDIR)/mouse.o \
|
||||||
|
$(OBJDIR)/activator.o \
|
||||||
|
$(OBJDIR)/xe_1ap.o \
|
||||||
|
$(OBJDIR)/teamplayer.o \
|
||||||
|
$(OBJDIR)/paddle.o \
|
||||||
|
$(OBJDIR)/sportspad.o \
|
||||||
|
$(OBJDIR)/terebi_oekaki.o \
|
||||||
|
$(OBJDIR)/graphic_board.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/sound.o \
|
||||||
|
$(OBJDIR)/sn76489.o \
|
||||||
|
$(OBJDIR)/ym2413.o \
|
||||||
|
$(OBJDIR)/ym2612.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/blip_buf.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/eq.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/sram.o \
|
||||||
|
$(OBJDIR)/svp.o \
|
||||||
|
$(OBJDIR)/ssp16.o \
|
||||||
|
$(OBJDIR)/ggenie.o \
|
||||||
|
$(OBJDIR)/areplay.o \
|
||||||
|
$(OBJDIR)/eeprom_93c.o \
|
||||||
|
$(OBJDIR)/eeprom_i2c.o \
|
||||||
|
$(OBJDIR)/eeprom_spi.o \
|
||||||
|
$(OBJDIR)/md_cart.o \
|
||||||
|
$(OBJDIR)/sms_cart.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/scd.o \
|
||||||
|
$(OBJDIR)/cdd.o \
|
||||||
|
$(OBJDIR)/cdc.o \
|
||||||
|
$(OBJDIR)/gfx.o \
|
||||||
|
$(OBJDIR)/pcm.o \
|
||||||
|
$(OBJDIR)/cd_cart.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/sms_ntsc.o \
|
||||||
|
$(OBJDIR)/md_ntsc.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/main.o \
|
||||||
|
$(OBJDIR)/emumain.o \
|
||||||
|
$(OBJDIR)/menu.o \
|
||||||
|
$(OBJDIR)/config.o \
|
||||||
|
$(OBJDIR)/error.o \
|
||||||
|
$(OBJDIR)/unzip.o \
|
||||||
|
$(OBJDIR)/fileio.o
|
||||||
|
|
||||||
|
OBJECTS += $(OBJDIR)/bitwise.o \
|
||||||
|
$(OBJDIR)/block.o \
|
||||||
|
$(OBJDIR)/codebook.o \
|
||||||
|
$(OBJDIR)/floor0.o \
|
||||||
|
$(OBJDIR)/floor1.o \
|
||||||
|
$(OBJDIR)/framing.o \
|
||||||
|
$(OBJDIR)/info.o \
|
||||||
|
$(OBJDIR)/mapping0.o \
|
||||||
|
$(OBJDIR)/mdct.o \
|
||||||
|
$(OBJDIR)/registry.o \
|
||||||
|
$(OBJDIR)/res012.o \
|
||||||
|
$(OBJDIR)/sharedbook.o \
|
||||||
|
$(OBJDIR)/synthesis.o \
|
||||||
|
$(OBJDIR)/vorbisfile.o \
|
||||||
|
$(OBJDIR)/window.o
|
||||||
|
|
||||||
|
|
||||||
|
all: $(NAME).velf
|
||||||
|
|
||||||
|
$(NAME).velf: $(NAME).elf
|
||||||
|
#advice from xyzz strip before create elf
|
||||||
|
arm-vita-eabi-strip -g $<
|
||||||
|
#i put db.json there use your location
|
||||||
|
vita-elf-create $< $@ db.json
|
||||||
|
|
||||||
|
$(NAME).elf: $(OBJDIR) $(OBJECTS)
|
||||||
|
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
|
||||||
|
|
||||||
|
$(OBJDIR) :
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/%.c $(SRCDIR)/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/sound/%.c $(SRCDIR)/sound/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/input_hw/%.c $(SRCDIR)/input_hw/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/cart_hw/%.c $(SRCDIR)/cart_hw/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/cart_hw/svp/%.c
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/cart_hw/svp/%.c $(SRCDIR)/cart_hw/svp/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/cd_hw/%.c $(SRCDIR)/cd_hw/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/z80/%.c $(SRCDIR)/z80/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/m68k/%.c
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/ntsc/%.c $(SRCDIR)/ntsc/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/tremor/%.c $(SRCDIR)/tremor/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/tremor/%.c
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o : $(SRCDIR)/../psp2/%.c $(SRCDIR)/../psp2/%.h
|
||||||
|
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJECTS) $(NAME).velf $(NAME).elf
|
54
psp2/config.c
Normal file
54
psp2/config.c
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
#include "osd.h"
|
||||||
|
|
||||||
|
t_config config;
|
||||||
|
|
||||||
|
void set_config_defaults(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* sound options */
|
||||||
|
config.psg_preamp = 150;
|
||||||
|
config.fm_preamp = 100;
|
||||||
|
config.hq_fm = 0;
|
||||||
|
config.psgBoostNoise = 1;
|
||||||
|
config.filter = 1;
|
||||||
|
config.low_freq = 200;
|
||||||
|
config.high_freq = 8000;
|
||||||
|
config.lg = 1.0;
|
||||||
|
config.mg = 1.0;
|
||||||
|
config.hg = 1.0;
|
||||||
|
config.lp_range = 0x9999; /* 0.6 in 16.16 fixed point */
|
||||||
|
config.dac_bits = 14;
|
||||||
|
config.ym2413 = 2; /* = AUTO (0 = always OFF, 1 = always ON) */
|
||||||
|
config.mono = 0;
|
||||||
|
|
||||||
|
/* system options */
|
||||||
|
config.system = 0; /* = AUTO (or SYSTEM_SG, SYSTEM_MARKIII, SYSTEM_SMS, SYSTEM_SMS2, SYSTEM_GG, SYSTEM_MD) */
|
||||||
|
config.region_detect = 0; /* = AUTO (1 = USA, 2 = EUROPE, 3 = JAPAN/NTSC, 4 = JAPAN/PAL) */
|
||||||
|
config.vdp_mode = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
|
||||||
|
config.master_clock = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
|
||||||
|
config.force_dtack = 0;
|
||||||
|
config.addr_error = 1;
|
||||||
|
config.bios = 0;
|
||||||
|
config.lock_on = 0; /* = OFF (can be TYPE_SK, TYPE_GG & TYPE_AR) */
|
||||||
|
config.ntsc = 0;
|
||||||
|
config.lcd = 0; /* 0.8 fixed point */
|
||||||
|
|
||||||
|
/* display options */
|
||||||
|
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
|
||||||
|
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
|
||||||
|
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
|
||||||
|
|
||||||
|
/* controllers options */
|
||||||
|
input.system[0] = SYSTEM_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_GAMEPAD;
|
||||||
|
config.gun_cursor[0] = 1;
|
||||||
|
config.gun_cursor[1] = 1;
|
||||||
|
config.invert_mouse = 0;
|
||||||
|
for (i=0;i<MAX_INPUTS;i++)
|
||||||
|
{
|
||||||
|
/* autodetected control pad type */
|
||||||
|
config.input[i].padtype = DEVICE_PAD2B | DEVICE_PAD3B | DEVICE_PAD6B;
|
||||||
|
}
|
||||||
|
}
|
57
psp2/config.h
Normal file
57
psp2/config.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
|
||||||
|
#ifndef _CONFIG_H_
|
||||||
|
#define _CONFIG_H_
|
||||||
|
|
||||||
|
#define MAX_INPUTS 8
|
||||||
|
#define MAX_KEYS 8
|
||||||
|
#define MAXPATHLEN 1024
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Config Option
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8 padtype;
|
||||||
|
} t_input_config;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8 hq_fm;
|
||||||
|
uint8 filter;
|
||||||
|
uint8 psgBoostNoise;
|
||||||
|
uint8 dac_bits;
|
||||||
|
uint8 ym2413;
|
||||||
|
int16 psg_preamp;
|
||||||
|
int16 fm_preamp;
|
||||||
|
uint32 lp_range;
|
||||||
|
int16 low_freq;
|
||||||
|
int16 high_freq;
|
||||||
|
int16 lg;
|
||||||
|
int16 mg;
|
||||||
|
int16 hg;
|
||||||
|
uint8 mono;
|
||||||
|
uint8 system;
|
||||||
|
uint8 region_detect;
|
||||||
|
uint8 vdp_mode;
|
||||||
|
uint8 master_clock;
|
||||||
|
uint8 force_dtack;
|
||||||
|
uint8 addr_error;
|
||||||
|
uint8 bios;
|
||||||
|
uint8 lock_on;
|
||||||
|
uint8 hot_swap;
|
||||||
|
uint8 invert_mouse;
|
||||||
|
uint8 gun_cursor[2];
|
||||||
|
uint8 overscan;
|
||||||
|
uint8 gg_extra;
|
||||||
|
uint8 ntsc;
|
||||||
|
uint8 lcd;
|
||||||
|
uint8 render;
|
||||||
|
t_input_config input[MAX_INPUTS];
|
||||||
|
} t_config;
|
||||||
|
|
||||||
|
/* Global variables */
|
||||||
|
extern t_config config;
|
||||||
|
extern void set_config_defaults(void);
|
||||||
|
|
||||||
|
#endif /* _CONFIG_H_ */
|
4466
psp2/db.json
Normal file
4466
psp2/db.json
Normal file
File diff suppressed because it is too large
Load Diff
442
psp2/emumain.c
Normal file
442
psp2/emumain.c
Normal file
@ -0,0 +1,442 @@
|
|||||||
|
#include "emumain.h"
|
||||||
|
|
||||||
|
#include <psp2/types.h>
|
||||||
|
#include <psp2/kernel/threadmgr.h>
|
||||||
|
#include "time.h"
|
||||||
|
#include <psp2/rtc.h>
|
||||||
|
|
||||||
|
#define SCE_KERNEL_OK 0
|
||||||
|
|
||||||
|
#include "psplib/pl_rewind.h"
|
||||||
|
#include "psplib/pl_file.h"
|
||||||
|
#include "psplib/pl_snd.h"
|
||||||
|
#include "psplib/pl_perf.h"
|
||||||
|
#include "psplib/pl_util.h"
|
||||||
|
#include "psplib/pl_psp.h"
|
||||||
|
#include "psplib/video.h"
|
||||||
|
#include "psplib/ctrl.h"
|
||||||
|
|
||||||
|
#include "shared.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "md_ntsc.h"
|
||||||
|
#include "sms_ntsc.h"
|
||||||
|
|
||||||
|
//#include <debugnet.h>
|
||||||
|
|
||||||
|
#define ip_server "192.168.1.130"
|
||||||
|
#define port_server 18194
|
||||||
|
|
||||||
|
PspImage *Screen;
|
||||||
|
pl_rewind Rewinder;
|
||||||
|
|
||||||
|
static pl_perf_counter FpsCounter;
|
||||||
|
static int ClearScreen;
|
||||||
|
static int ScreenX, ScreenY, ScreenW, ScreenH;
|
||||||
|
static int TicksPerUpdate;
|
||||||
|
static u32 TicksPerSecond;
|
||||||
|
static u64 LastTick;
|
||||||
|
static u64 CurrentTick;
|
||||||
|
static int Frame;
|
||||||
|
|
||||||
|
static int Rewinding;
|
||||||
|
|
||||||
|
extern pl_file_path CurrentGame;
|
||||||
|
extern EmulatorOptions Options;
|
||||||
|
extern const u64 ButtonMask[];
|
||||||
|
extern const int ButtonMapId[];
|
||||||
|
extern struct ButtonConfig ActiveConfig;
|
||||||
|
extern char *ScreenshotPath;
|
||||||
|
|
||||||
|
static short soundbuffer[SOUND_SAMPLES*2*10];
|
||||||
|
static int soundPosWrite = 0;
|
||||||
|
static int soundPosRead = 0;
|
||||||
|
static SceUID console_mtx;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static inline void RenderVideo();
|
||||||
|
static void AudioCallback(pl_snd_sample* buf,
|
||||||
|
unsigned int samples,
|
||||||
|
void *userdata);
|
||||||
|
void MixerCallback(int16 **stream, int16 **output, int length);
|
||||||
|
md_ntsc_t *md_ntsc;
|
||||||
|
sms_ntsc_t *sms_ntsc;
|
||||||
|
|
||||||
|
int bEmulate;
|
||||||
|
|
||||||
|
void osd_input_update()
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Reset input */
|
||||||
|
input.pad[0] = 0;
|
||||||
|
input.analog[0][0] = 0x7F;
|
||||||
|
|
||||||
|
static SceCtrlData pad;
|
||||||
|
static int autofire_status = 0;
|
||||||
|
|
||||||
|
/* Check the input */
|
||||||
|
if (pspCtrlPollControls(&pad))
|
||||||
|
{
|
||||||
|
if (--autofire_status < 0)
|
||||||
|
autofire_status = Options.AutoFire;
|
||||||
|
|
||||||
|
/* Parse input */
|
||||||
|
int i, on, code;
|
||||||
|
for (i = 0; ButtonMapId[i] >= 0; i++)
|
||||||
|
{
|
||||||
|
code = ActiveConfig.ButtonMap[ButtonMapId[i]];
|
||||||
|
on = (pad.buttons & ButtonMask[i]) == ButtonMask[i];
|
||||||
|
|
||||||
|
/* Check to see if a button set is pressed. If so, unset it, so it */
|
||||||
|
/* doesn't trigger any other combination presses. */
|
||||||
|
if (on) pad.buttons &= ~ButtonMask[i];
|
||||||
|
|
||||||
|
if (code & AFI)
|
||||||
|
{
|
||||||
|
if (on && (autofire_status == 0))
|
||||||
|
input.pad[0] |= CODE_MASK(code);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (code & JOY)
|
||||||
|
{
|
||||||
|
if (on) {
|
||||||
|
input.pad[0] |= CODE_MASK(code);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (code & SYS)
|
||||||
|
{
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
if (CODE_MASK(code) == (INPUT_START))
|
||||||
|
input.system[0] |= INPUT_START;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (code & SPC)
|
||||||
|
{
|
||||||
|
switch (CODE_MASK(code))
|
||||||
|
{
|
||||||
|
case SPC_MENU:
|
||||||
|
if (on) bEmulate=0;
|
||||||
|
break;
|
||||||
|
case SPC_REWIND:
|
||||||
|
Rewinding = on;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitEmulator()
|
||||||
|
{
|
||||||
|
|
||||||
|
//debugNetInit(ip_server,port_server,DEBUG);
|
||||||
|
|
||||||
|
set_config_defaults();
|
||||||
|
|
||||||
|
ClearScreen = 0;
|
||||||
|
|
||||||
|
/* Initialize screen buffer */
|
||||||
|
Screen = pspImageCreateVram(720, 576, PSP_IMAGE_16BPP);
|
||||||
|
|
||||||
|
// pspImageClear(Screen, 0x8000);
|
||||||
|
|
||||||
|
console_mtx = sceKernelCreateSema("sound_sema", 0, 0, 1, 0);
|
||||||
|
/*if (console_mtx > 0) {
|
||||||
|
debugNetPrintf(DEBUG,"Sound Mutex UID: 0x%08X\n", console_mtx);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* Set up bitmap structure */
|
||||||
|
memset(&bitmap, 0, sizeof(t_bitmap));
|
||||||
|
bitmap.width = Screen->Width;
|
||||||
|
bitmap.height = Screen->Height;
|
||||||
|
bitmap.pitch = (bitmap.width * 2);
|
||||||
|
bitmap.data = (unsigned char *)Screen->Pixels;
|
||||||
|
bitmap.viewport.changed = 3;
|
||||||
|
|
||||||
|
pl_snd_set_callback(0, AudioCallback, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunEmulator()
|
||||||
|
{
|
||||||
|
float ratio;
|
||||||
|
//debugNetPrintf(DEBUG,"RunEmulator\n");
|
||||||
|
|
||||||
|
pspImageClear(Screen, 0);
|
||||||
|
//debugNetPrintf(DEBUG,"ImageClear\n");
|
||||||
|
|
||||||
|
|
||||||
|
if(bitmap.viewport.changed & 1)
|
||||||
|
{
|
||||||
|
bitmap.viewport.changed &= ~1;
|
||||||
|
|
||||||
|
/* source bitmap */
|
||||||
|
Screen->Viewport.Width = bitmap.viewport.w+2*bitmap.viewport.x;
|
||||||
|
Screen->Viewport.Height = bitmap.viewport.h+2*bitmap.viewport.y;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Recompute screen size/position */
|
||||||
|
switch (Options.DisplayMode)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case DISPLAY_MODE_UNSCALED:
|
||||||
|
ScreenW = Screen->Viewport.Width;
|
||||||
|
ScreenH = Screen->Viewport.Height;
|
||||||
|
break;
|
||||||
|
case DISPLAY_MODE_FIT_HEIGHT:
|
||||||
|
ratio = (float)SCR_HEIGHT / (float)Screen->Viewport.Height;
|
||||||
|
ScreenW = (float)bitmap.viewport.w * ratio - 2;
|
||||||
|
ScreenH = SCR_HEIGHT;
|
||||||
|
break;
|
||||||
|
case DISPLAY_MODE_FILL_SCREEN:
|
||||||
|
ScreenW = SCR_WIDTH;
|
||||||
|
ScreenH = SCR_HEIGHT;
|
||||||
|
break;
|
||||||
|
case DISPLAY_MODE_2X:
|
||||||
|
ScreenW = Screen->Viewport.Width*2;
|
||||||
|
ScreenH = Screen->Viewport.Height*2;
|
||||||
|
break;
|
||||||
|
case DISPLAY_MODE_3X:
|
||||||
|
ScreenW = Screen->Viewport.Width*3;
|
||||||
|
ScreenH = Screen->Viewport.Height*3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//debugNetPrintf(DEBUG,"screensize %d %d\n" ,Screen->Viewport.Width ,Screen->Viewport.Height);
|
||||||
|
|
||||||
|
ScreenX = (SCR_WIDTH / 2) - (ScreenW / 2);
|
||||||
|
ScreenY = (SCR_HEIGHT / 2) - (ScreenH / 2);
|
||||||
|
|
||||||
|
/* Init performance counter */
|
||||||
|
pl_perf_init_counter(&FpsCounter);
|
||||||
|
|
||||||
|
/* Recompute update frequency */
|
||||||
|
TicksPerSecond = sceRtcGetTickResolution();
|
||||||
|
if (Options.UpdateFreq)
|
||||||
|
{
|
||||||
|
TicksPerUpdate = TicksPerSecond
|
||||||
|
/ (Options.UpdateFreq / (Options.Frameskip + 1));
|
||||||
|
sceRtcGetCurrentTick(&LastTick);
|
||||||
|
}
|
||||||
|
Frame = 0;
|
||||||
|
ClearScreen = 2;
|
||||||
|
Rewinding = 0;
|
||||||
|
|
||||||
|
//pl_rewind_realloc(&Rewinder);
|
||||||
|
|
||||||
|
int frames_until_save = 0;
|
||||||
|
|
||||||
|
/* Resume sound */
|
||||||
|
pl_snd_resume(0);
|
||||||
|
|
||||||
|
/* Wait for V. refresh */
|
||||||
|
pspVideoWaitVSync();
|
||||||
|
|
||||||
|
bEmulate = 1;
|
||||||
|
/* Main emulation loop */
|
||||||
|
while (!ExitPSP&&bEmulate)
|
||||||
|
{
|
||||||
|
/* Rewind/save state */
|
||||||
|
/*if (!Rewinding)
|
||||||
|
{
|
||||||
|
if (--frames_until_save <= 0)
|
||||||
|
{
|
||||||
|
frames_until_save = Options.RewindSaveRate;
|
||||||
|
pl_rewind_save(&Rewinder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frames_until_save = Options.RewindSaveRate;
|
||||||
|
if (!pl_rewind_restore(&Rewinder))
|
||||||
|
continue;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* Run the system emulation for a frame */
|
||||||
|
if (++Frame <= Options.Frameskip)
|
||||||
|
{
|
||||||
|
/* Skip frame */
|
||||||
|
if (system_hw == SYSTEM_MCD)
|
||||||
|
{
|
||||||
|
system_frame_scd(1);
|
||||||
|
}
|
||||||
|
else if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
system_frame_gen(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
system_frame_sms(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (system_hw == SYSTEM_MCD)
|
||||||
|
{
|
||||||
|
system_frame_scd(0);
|
||||||
|
}
|
||||||
|
else if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
|
||||||
|
{
|
||||||
|
system_frame_gen(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
system_frame_sms(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Frame = 0;
|
||||||
|
/* Display */
|
||||||
|
if(bitmap.viewport.changed & 1)
|
||||||
|
{
|
||||||
|
bitmap.viewport.changed &= ~1;
|
||||||
|
|
||||||
|
/* source bitmap */
|
||||||
|
Screen->Viewport.Width = bitmap.viewport.w+2*bitmap.viewport.x;
|
||||||
|
Screen->Viewport.Height = bitmap.viewport.h+2*bitmap.viewport.y;
|
||||||
|
|
||||||
|
/* Recompute screen size/position */
|
||||||
|
switch (Options.DisplayMode)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case DISPLAY_MODE_UNSCALED:
|
||||||
|
ScreenW = Screen->Viewport.Width;
|
||||||
|
ScreenH = Screen->Viewport.Height;
|
||||||
|
break;
|
||||||
|
case DISPLAY_MODE_FIT_HEIGHT:
|
||||||
|
ratio = (float)SCR_HEIGHT / (float)Screen->Viewport.Height;
|
||||||
|
ScreenW = (float)bitmap.viewport.w * ratio - 2;
|
||||||
|
ScreenH = SCR_HEIGHT;
|
||||||
|
break;
|
||||||
|
case DISPLAY_MODE_FILL_SCREEN:
|
||||||
|
ScreenW = SCR_WIDTH;
|
||||||
|
ScreenH = SCR_HEIGHT;
|
||||||
|
break;
|
||||||
|
case DISPLAY_MODE_2X:
|
||||||
|
ScreenW = Screen->Viewport.Width*2;
|
||||||
|
ScreenH = Screen->Viewport.Height*2;
|
||||||
|
break;
|
||||||
|
case DISPLAY_MODE_3X:
|
||||||
|
ScreenW = Screen->Viewport.Width*3;
|
||||||
|
ScreenH = Screen->Viewport.Height*3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScreenX = (SCR_WIDTH / 2) - (ScreenW / 2);
|
||||||
|
ScreenY = (SCR_HEIGHT / 2) - (ScreenH / 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
//debugNetPrintf(DEBUG,"main %d %d \n",soundPosRead,soundPosWrite);
|
||||||
|
int size = audio_update(&soundbuffer[soundPosRead])*2;
|
||||||
|
//debugNetPrintf(DEBUG,"filling %d \n",size);
|
||||||
|
|
||||||
|
soundPosRead +=size;
|
||||||
|
if(soundPosRead+size>=(SOUND_SAMPLES*2*10)){
|
||||||
|
soundPosRead = 0;
|
||||||
|
}
|
||||||
|
if((soundPosRead-soundPosWrite)>=(SOUND_SAMPLES*2)||(soundPosRead-soundPosWrite)<0){
|
||||||
|
sceKernelSignalSema(console_mtx, 1); //lock
|
||||||
|
}
|
||||||
|
RenderVideo();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stop sound */
|
||||||
|
pl_snd_pause(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrashEmulator()
|
||||||
|
{
|
||||||
|
pl_rewind_destroy(&Rewinder);
|
||||||
|
|
||||||
|
/* Trash screen */
|
||||||
|
if (Screen) pspImageDestroy(Screen);
|
||||||
|
|
||||||
|
if (CurrentGame[0] != '\0')
|
||||||
|
{
|
||||||
|
/* Release emulation resources */
|
||||||
|
audio_shutdown();
|
||||||
|
error_shutdown();
|
||||||
|
}
|
||||||
|
//debugNetFinish();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void RenderVideo()
|
||||||
|
{
|
||||||
|
/* Update the display */
|
||||||
|
pspVideoBegin();
|
||||||
|
|
||||||
|
/* Clear the buffer first, if necessary */
|
||||||
|
if (ClearScreen >= 0)
|
||||||
|
{
|
||||||
|
ClearScreen--;
|
||||||
|
pspVideoClearScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
pspVideoPutImage(Screen, ScreenX, ScreenY, ScreenW, ScreenH);
|
||||||
|
|
||||||
|
/* Show FPS counter */
|
||||||
|
if (Options.ShowFps)
|
||||||
|
{
|
||||||
|
static char fps_display[32];
|
||||||
|
sprintf(fps_display, " %3.02f", pl_perf_update_counter(&FpsCounter));
|
||||||
|
|
||||||
|
int width = pspFontGetTextWidth(&PspStockFont, fps_display);
|
||||||
|
int height = pspFontGetLineHeight(&PspStockFont);
|
||||||
|
|
||||||
|
pspVideoFillRect(SCR_WIDTH - width, 0, SCR_WIDTH, height, PSP_COLOR_BLACK);
|
||||||
|
pspVideoPrint(&PspStockFont, SCR_WIDTH - width, 0, fps_display, PSP_COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
pspVideoEnd();
|
||||||
|
|
||||||
|
/* Wait if needed */
|
||||||
|
if (Options.UpdateFreq)
|
||||||
|
{
|
||||||
|
do { sceRtcGetCurrentTick(&CurrentTick); }
|
||||||
|
while (CurrentTick - LastTick < TicksPerUpdate);
|
||||||
|
LastTick = CurrentTick;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait for VSync signal */
|
||||||
|
if (Options.VSync)
|
||||||
|
pspVideoWaitVSync();
|
||||||
|
|
||||||
|
/* Swap buffers */
|
||||||
|
pspVideoSwapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AudioCallback(pl_snd_sample *buf,
|
||||||
|
unsigned int samples,
|
||||||
|
void *userdata)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
//debugNetPrintf(DEBUG,"wait %d %d \n",totalSamples,samples);
|
||||||
|
if (!Rewinding)
|
||||||
|
{
|
||||||
|
short* ptr_s = (short*)buf;
|
||||||
|
//debugNetPrintf(DEBUG,"wait %d %d \n",soundPosRead,soundPosWrite);
|
||||||
|
if((soundPosRead-soundPosWrite)<SOUND_SAMPLES*2){
|
||||||
|
sceKernelWaitSema(console_mtx, 1, 0); //lock
|
||||||
|
//debugNetPrintf(DEBUG,"start %d %d \n",soundPosRead,soundPosWrite);
|
||||||
|
}
|
||||||
|
memcpy(ptr_s,&soundbuffer[soundPosWrite],sizeof(short)*samples*2);
|
||||||
|
soundPosWrite +=samples*2;
|
||||||
|
if(soundPosWrite+(samples*2)>=(SOUND_SAMPLES*2*10)){
|
||||||
|
soundPosWrite = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /* Render silence */
|
||||||
|
for (i = 0; i < samples; i++)
|
||||||
|
buf[i].stereo.l = buf[i].stereo.r = 0;
|
||||||
|
}
|
77
psp2/emumain.h
Normal file
77
psp2/emumain.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#ifndef _EMUMAIN_H
|
||||||
|
#define _EMUMAIN_H
|
||||||
|
|
||||||
|
|
||||||
|
#define int32 int32_t
|
||||||
|
#define int16 int16_t
|
||||||
|
#define u32 uint32_t
|
||||||
|
#define u64 uint64_t
|
||||||
|
#define ScePspDateTime SceDateTime
|
||||||
|
|
||||||
|
#define SOUND_FREQUENCY 48000
|
||||||
|
#define SOUND_SAMPLES 832
|
||||||
|
|
||||||
|
void InitEmulator();
|
||||||
|
void RunEmulator();
|
||||||
|
void TrashEmulator();
|
||||||
|
|
||||||
|
#define DISPLAY_MODE_UNSCALED 0
|
||||||
|
#define DISPLAY_MODE_FIT_HEIGHT 1
|
||||||
|
#define DISPLAY_MODE_FILL_SCREEN 2
|
||||||
|
#define DISPLAY_MODE_2X 3
|
||||||
|
#define DISPLAY_MODE_3X 4
|
||||||
|
|
||||||
|
#define JOY 0x10000
|
||||||
|
#define SYS 0x20000
|
||||||
|
#define SPC 0x40000
|
||||||
|
#define AFI 0x80000
|
||||||
|
|
||||||
|
#define CODE_MASK(x) (x & 0xffff)
|
||||||
|
|
||||||
|
#define SPC_MENU 1
|
||||||
|
#define SPC_REWIND 2
|
||||||
|
|
||||||
|
#define MAP_BUTTONS 18
|
||||||
|
|
||||||
|
#define MAP_ANALOG_UP 0
|
||||||
|
#define MAP_ANALOG_DOWN 1
|
||||||
|
#define MAP_ANALOG_LEFT 2
|
||||||
|
#define MAP_ANALOG_RIGHT 3
|
||||||
|
#define MAP_BUTTON_UP 4
|
||||||
|
#define MAP_BUTTON_DOWN 5
|
||||||
|
#define MAP_BUTTON_LEFT 6
|
||||||
|
#define MAP_BUTTON_RIGHT 7
|
||||||
|
#define MAP_BUTTON_SQUARE 8
|
||||||
|
#define MAP_BUTTON_CROSS 9
|
||||||
|
#define MAP_BUTTON_CIRCLE 10
|
||||||
|
#define MAP_BUTTON_TRIANGLE 11
|
||||||
|
#define MAP_BUTTON_LTRIGGER 12
|
||||||
|
#define MAP_BUTTON_RTRIGGER 13
|
||||||
|
#define MAP_BUTTON_SELECT 14
|
||||||
|
#define MAP_BUTTON_START 15
|
||||||
|
#define MAP_BUTTON_LRTRIGGERS 16
|
||||||
|
#define MAP_BUTTON_STARTSELECT 17
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int ShowFps;
|
||||||
|
int ControlMode;
|
||||||
|
int ClockFreq;
|
||||||
|
int DisplayMode;
|
||||||
|
int VSync;
|
||||||
|
int UpdateFreq;
|
||||||
|
int Frameskip;
|
||||||
|
int VertStrip;
|
||||||
|
int SoundEngine;
|
||||||
|
int SoundBoost;
|
||||||
|
int AutoFire;
|
||||||
|
int RewindSaveRate;
|
||||||
|
int RewindReplayDelay;
|
||||||
|
} EmulatorOptions;
|
||||||
|
|
||||||
|
struct ButtonConfig
|
||||||
|
{
|
||||||
|
unsigned int ButtonMap[MAP_BUTTONS];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _EMUMAIN_H
|
35
psp2/error.c
Normal file
35
psp2/error.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
error.c --
|
||||||
|
Error logging
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "osd.h"
|
||||||
|
|
||||||
|
static FILE *error_log;
|
||||||
|
|
||||||
|
void error_init(void)
|
||||||
|
{
|
||||||
|
#ifdef LOGERROR
|
||||||
|
error_log = fopen("error.log","w");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void error_shutdown(void)
|
||||||
|
{
|
||||||
|
#ifdef LOGERROR
|
||||||
|
if(error_log) fclose(error_log);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void error(char *format, ...)
|
||||||
|
{
|
||||||
|
#ifdef LOGERROR
|
||||||
|
if (log_error)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
if(error_log) vfprintf(error_log, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
10
psp2/error.h
Normal file
10
psp2/error.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef _ERROR_H_
|
||||||
|
#define _ERROR_H_
|
||||||
|
|
||||||
|
/* Function prototypes */
|
||||||
|
void error_init(void);
|
||||||
|
void error_shutdown(void);
|
||||||
|
void error(char *format, ...);
|
||||||
|
|
||||||
|
#endif /* _ERROR_H_ */
|
||||||
|
|
154
psp2/fileio.c
Normal file
154
psp2/fileio.c
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
* fileio.c
|
||||||
|
*
|
||||||
|
* Load a normal file, or ZIP/GZ archive into ROM buffer.
|
||||||
|
* Returns loaded ROM size (zero if an error occured)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
|
||||||
|
* modified by Eke-Eke (Genesis Plus GX)
|
||||||
|
*
|
||||||
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
|
* provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
|
* product or activity.
|
||||||
|
*
|
||||||
|
* - Redistributions that are modified from the original source must include the
|
||||||
|
* complete source code, including the source code for all components used by a
|
||||||
|
* binary built from the modified sources. However, as a special exception, the
|
||||||
|
* source code distributed need not include anything that is normally distributed
|
||||||
|
* (in either source or binary form) with the major components (compiler, kernel,
|
||||||
|
* and so on) of the operating system on which the executable runs, unless that
|
||||||
|
* component itself accompanies the executable.
|
||||||
|
*
|
||||||
|
* - Redistributions must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other
|
||||||
|
* materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#include "shared.h"
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
|
static int check_zip(char *filename);
|
||||||
|
|
||||||
|
int load_archive(char *filename, unsigned char *buffer, int maxsize, char *extension)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
|
||||||
|
if(check_zip(filename))
|
||||||
|
{
|
||||||
|
unz_file_info info;
|
||||||
|
int ret = 0;
|
||||||
|
char fname[256];
|
||||||
|
|
||||||
|
/* Attempt to open the archive */
|
||||||
|
unzFile *fd = unzOpen(filename);
|
||||||
|
if (!fd) return 0;
|
||||||
|
|
||||||
|
/* Go to first file in archive */
|
||||||
|
ret = unzGoToFirstFile(fd);
|
||||||
|
if(ret != UNZ_OK)
|
||||||
|
{
|
||||||
|
unzClose(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get file informations and update filename */
|
||||||
|
ret = unzGetCurrentFileInfo(fd, &info, fname, 256, NULL, 0, NULL, 0);
|
||||||
|
if(ret != UNZ_OK)
|
||||||
|
{
|
||||||
|
unzClose(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compressed filename extension */
|
||||||
|
if (extension)
|
||||||
|
{
|
||||||
|
strncpy(extension, &fname[strlen(fname) - 3], 3);
|
||||||
|
extension[3] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the file for reading */
|
||||||
|
ret = unzOpenCurrentFile(fd);
|
||||||
|
if(ret != UNZ_OK)
|
||||||
|
{
|
||||||
|
unzClose(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Retrieve uncompressed file size */
|
||||||
|
size = info.uncompressed_size;
|
||||||
|
if(size > maxsize)
|
||||||
|
{
|
||||||
|
size = maxsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read (decompress) the file */
|
||||||
|
ret = unzReadCurrentFile(fd, buffer, size);
|
||||||
|
if(ret != size)
|
||||||
|
{
|
||||||
|
unzCloseCurrentFile(fd);
|
||||||
|
unzClose(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the current file */
|
||||||
|
ret = unzCloseCurrentFile(fd);
|
||||||
|
if(ret != UNZ_OK)
|
||||||
|
{
|
||||||
|
unzClose(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the archive */
|
||||||
|
ret = unzClose(fd);
|
||||||
|
if(ret != UNZ_OK) return 0;
|
||||||
|
}
|
||||||
|
/*else
|
||||||
|
{
|
||||||
|
gzFile *gd = gzopen(filename, "rb");
|
||||||
|
if (!gd) return 0;
|
||||||
|
|
||||||
|
size = gzread(gd, buffer, maxsize);
|
||||||
|
|
||||||
|
if (extension)
|
||||||
|
{
|
||||||
|
strncpy(extension, &filename[strlen(filename) - 3], 3);
|
||||||
|
extension[3] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
gzclose(gd);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* Return loaded ROM size */
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Verifies if a file is a ZIP archive or not.
|
||||||
|
Returns: 1= ZIP archive, 0= not a ZIP archive
|
||||||
|
*/
|
||||||
|
static int check_zip(char *filename)
|
||||||
|
{
|
||||||
|
uint8 buf[2];
|
||||||
|
FILE *fd = fopen(filename, "rb");
|
||||||
|
if(!fd) return (0);
|
||||||
|
fread(buf, 2, 1, fd);
|
||||||
|
fclose(fd);
|
||||||
|
if(memcmp(buf, "PK", 2) == 0) return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
48
psp2/fileio.h
Normal file
48
psp2/fileio.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* fileio.c
|
||||||
|
*
|
||||||
|
* Load a normal file, or ZIP/GZ archive.
|
||||||
|
* Returns loaded ROM size (zero if an error occured)
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
|
||||||
|
* modified by Eke-Eke (Genesis Plus GX)
|
||||||
|
*
|
||||||
|
* Redistribution and use of this code or any derivative works are permitted
|
||||||
|
* provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions may not be sold, nor may they be used in a commercial
|
||||||
|
* product or activity.
|
||||||
|
*
|
||||||
|
* - Redistributions that are modified from the original source must include the
|
||||||
|
* complete source code, including the source code for all components used by a
|
||||||
|
* binary built from the modified sources. However, as a special exception, the
|
||||||
|
* source code distributed need not include anything that is normally distributed
|
||||||
|
* (in either source or binary form) with the major components (compiler, kernel,
|
||||||
|
* and so on) of the operating system on which the executable runs, unless that
|
||||||
|
* component itself accompanies the executable.
|
||||||
|
*
|
||||||
|
* - Redistributions must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other
|
||||||
|
* materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _FILEIO_H_
|
||||||
|
#define _FILEIO_H_
|
||||||
|
|
||||||
|
/* Function prototypes */
|
||||||
|
extern int load_archive(char *filename, unsigned char *buffer, int maxsize, char *extension);
|
||||||
|
|
||||||
|
#endif /* _FILEIO_H_ */
|
50
psp2/main.c
Normal file
50
psp2/main.c
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <psp2/moduleinfo.h>
|
||||||
|
#include <psp2/kernel/threadmgr.h>
|
||||||
|
#include "psplib/pl_snd.h"
|
||||||
|
#include "psplib/video.h"
|
||||||
|
#include "psplib/pl_psp.h"
|
||||||
|
#include "psplib/ctrl.h"
|
||||||
|
#include <vita2d.h>
|
||||||
|
|
||||||
|
#include "menu.h"
|
||||||
|
#include "emumain.h"
|
||||||
|
|
||||||
|
|
||||||
|
PSP2_MODULE_INFO(0,1,PSP_APP_NAME)
|
||||||
|
//PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER)
|
||||||
|
|
||||||
|
static void ExitCallback(void* arg)
|
||||||
|
{
|
||||||
|
ExitPSP = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc,char *argv[])
|
||||||
|
{
|
||||||
|
/* Initialize PSP */
|
||||||
|
pl_psp_init("cache0:/GENPlusVITA/");
|
||||||
|
pl_snd_init(SOUND_SAMPLES, 1);
|
||||||
|
pspCtrlInit();
|
||||||
|
pspVideoInit();
|
||||||
|
|
||||||
|
/* Initialize callbacks */
|
||||||
|
pl_psp_register_callback(PSP_EXIT_CALLBACK,
|
||||||
|
ExitCallback,
|
||||||
|
NULL);
|
||||||
|
pl_psp_start_callback_thread();
|
||||||
|
|
||||||
|
/* Start emulation */
|
||||||
|
InitMenu();
|
||||||
|
DisplayMenu();
|
||||||
|
TrashMenu();
|
||||||
|
|
||||||
|
/* Release PSP resources */
|
||||||
|
pl_snd_shutdown();
|
||||||
|
pspVideoShutdown();
|
||||||
|
pl_psp_shutdown();
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
11
psp2/main.h
Normal file
11
psp2/main.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
#ifndef _MAIN_H_
|
||||||
|
#define _MAIN_H_
|
||||||
|
|
||||||
|
#define MAX_INPUTS 8
|
||||||
|
|
||||||
|
extern int debug_on;
|
||||||
|
extern int log_error;
|
||||||
|
extern int sdl_input_update(void);
|
||||||
|
|
||||||
|
#endif /* _MAIN_H_ */
|
1289
psp2/menu.c
Normal file
1289
psp2/menu.c
Normal file
File diff suppressed because it is too large
Load Diff
8
psp2/menu.h
Normal file
8
psp2/menu.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef _MENU_H
|
||||||
|
#define _MENU_H
|
||||||
|
|
||||||
|
void InitMenu();
|
||||||
|
void DisplayMenu();
|
||||||
|
void TrashMenu();
|
||||||
|
|
||||||
|
#endif
|
34
psp2/osd.h
Normal file
34
psp2/osd.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
#ifndef _OSD_H_
|
||||||
|
#define _OSD_H_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "shared.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "unzip.h"
|
||||||
|
#include "fileio.h"
|
||||||
|
|
||||||
|
extern void osd_input_update(void);
|
||||||
|
|
||||||
|
|
||||||
|
#define GG_ROM "./ggenie.bin"
|
||||||
|
#define AR_ROM "./areplay.bin"
|
||||||
|
#define SK_ROM "./sk.bin"
|
||||||
|
#define SK_UPMEM "./sk2chip.bin"
|
||||||
|
#define CD_BIOS_US "./bios_CD_U.bin"
|
||||||
|
#define CD_BIOS_EU "./bios_CD_E.bin"
|
||||||
|
#define CD_BIOS_JP "./bios_CD_J.bin"
|
||||||
|
#define MD_BIOS "./bios_MD.bin"
|
||||||
|
#define MS_BIOS_US "./bios_U.sms"
|
||||||
|
#define MS_BIOS_EU "./bios_E.sms"
|
||||||
|
#define MS_BIOS_JP "./bios_J.sms"
|
||||||
|
#define GG_BIOS "./bios.gg"
|
||||||
|
|
||||||
|
#endif /* _OSD_H_ */
|
1294
psp2/unzip.c
Normal file
1294
psp2/unzip.c
Normal file
File diff suppressed because it is too large
Load Diff
273
psp2/unzip.h
Normal file
273
psp2/unzip.h
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||||
|
Version 0.15 beta, Mar 19th, 1998,
|
||||||
|
|
||||||
|
Copyright (C) 1998 Gilles Vollant
|
||||||
|
|
||||||
|
This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
|
||||||
|
WinZip, InfoZip tools and compatible.
|
||||||
|
Encryption and multi volume ZipFile (span) are not supported.
|
||||||
|
Old compressions used by old PKZip 1.x are not supported
|
||||||
|
|
||||||
|
THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
|
||||||
|
CAN CHANGE IN FUTURE VERSION !!
|
||||||
|
I WAIT FEEDBACK at mail info@winimage.com
|
||||||
|
Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
|
||||||
|
|
||||||
|
Condition of use and distribution are the same than zlib :
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* for more info about .ZIP format, see
|
||||||
|
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
|
||||||
|
PkWare has also a specification at :
|
||||||
|
ftp://ftp.pkware.com/probdesc.zip */
|
||||||
|
|
||||||
|
#ifndef _unz_H
|
||||||
|
#define _unz_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ZLIB_H
|
||||||
|
#include "zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||||
|
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||||
|
from (void*) without cast */
|
||||||
|
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||||
|
typedef unzFile__ *unzFile;
|
||||||
|
#else
|
||||||
|
typedef voidp unzFile;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define UNZ_OK (0)
|
||||||
|
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
||||||
|
#define UNZ_ERRNO (Z_ERRNO)
|
||||||
|
#define UNZ_EOF (0)
|
||||||
|
#define UNZ_PARAMERROR (-102)
|
||||||
|
#define UNZ_BADZIPFILE (-103)
|
||||||
|
#define UNZ_INTERNALERROR (-104)
|
||||||
|
#define UNZ_CRCERROR (-105)
|
||||||
|
|
||||||
|
/* tm_unz contain date/time info */
|
||||||
|
typedef struct tm_unz_s
|
||||||
|
{
|
||||||
|
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||||
|
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||||
|
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||||
|
uInt tm_mday; /* day of the month - [1,31] */
|
||||||
|
uInt tm_mon; /* months since January - [0,11] */
|
||||||
|
uInt tm_year; /* years - [1980..2044] */
|
||||||
|
} tm_unz;
|
||||||
|
|
||||||
|
/* unz_global_info structure contain global data about the ZIPfile
|
||||||
|
These data comes from the end of central dir */
|
||||||
|
typedef struct unz_global_info_s
|
||||||
|
{
|
||||||
|
uLong number_entry; /* total number of entries in
|
||||||
|
the central dir on this disk */
|
||||||
|
uLong size_comment; /* size of the global comment of the zipfile */
|
||||||
|
} unz_global_info;
|
||||||
|
|
||||||
|
|
||||||
|
/* unz_file_info contain information about a file in the zipfile */
|
||||||
|
typedef struct unz_file_info_s
|
||||||
|
{
|
||||||
|
uLong version; /* version made by 2 bytes */
|
||||||
|
uLong version_needed; /* version needed to extract 2 bytes */
|
||||||
|
uLong flag; /* general purpose bit flag 2 bytes */
|
||||||
|
uLong compression_method; /* compression method 2 bytes */
|
||||||
|
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||||
|
uLong crc; /* crc-32 4 bytes */
|
||||||
|
uLong compressed_size; /* compressed size 4 bytes */
|
||||||
|
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||||
|
uLong size_filename; /* filename length 2 bytes */
|
||||||
|
uLong size_file_extra; /* extra field length 2 bytes */
|
||||||
|
uLong size_file_comment; /* file comment length 2 bytes */
|
||||||
|
|
||||||
|
uLong disk_num_start; /* disk number start 2 bytes */
|
||||||
|
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||||
|
uLong external_fa; /* external file attributes 4 bytes */
|
||||||
|
|
||||||
|
tm_unz tmu_date;
|
||||||
|
} unz_file_info;
|
||||||
|
|
||||||
|
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||||
|
const char* fileName2,
|
||||||
|
int iCaseSensitivity));
|
||||||
|
/*
|
||||||
|
Compare two filename (fileName1,fileName2).
|
||||||
|
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||||
|
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||||
|
or strcasecmp)
|
||||||
|
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||||
|
(like 1 on Unix, 2 on Windows)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||||
|
/*
|
||||||
|
Open a Zip file. path contain the full pathname (by example,
|
||||||
|
on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
|
||||||
|
"zlib/zlib111.zip".
|
||||||
|
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||||
|
return value is NULL.
|
||||||
|
Else, the return value is a unzFile Handle, usable with other function
|
||||||
|
of this unzip package.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzClose OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Close a ZipFile opened with unzipOpen.
|
||||||
|
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||||
|
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
|
||||||
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||||
|
unz_global_info *pglobal_info));
|
||||||
|
/*
|
||||||
|
Write info about the ZipFile in the *pglobal_info structure.
|
||||||
|
No preparation of the structure is needed
|
||||||
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||||
|
char *szComment,
|
||||||
|
uLong uSizeBuf));
|
||||||
|
/*
|
||||||
|
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||||
|
uSizeBuf is the size of the szComment buffer.
|
||||||
|
return the number of byte copied or an error code <0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Unzip package allow you browse the directory of the zipfile */
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Set the current file of the zipfile to the first file.
|
||||||
|
return UNZ_OK if there is no problem
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Set the current file of the zipfile to the next file.
|
||||||
|
return UNZ_OK if there is no problem
|
||||||
|
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||||
|
const char *szFileName,
|
||||||
|
int iCaseSensitivity));
|
||||||
|
/*
|
||||||
|
Try locate the file szFileName in the zipfile.
|
||||||
|
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||||
|
|
||||||
|
return value :
|
||||||
|
UNZ_OK if the file is found. It becomes the current file.
|
||||||
|
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||||
|
unz_file_info *pfile_info,
|
||||||
|
char *szFileName,
|
||||||
|
uLong fileNameBufferSize,
|
||||||
|
void *extraField,
|
||||||
|
uLong extraFieldBufferSize,
|
||||||
|
char *szComment,
|
||||||
|
uLong commentBufferSize));
|
||||||
|
/*
|
||||||
|
Get Info about the current file
|
||||||
|
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||||
|
the current file
|
||||||
|
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||||
|
(fileNameBufferSize is the size of the buffer)
|
||||||
|
if extraField!=NULL, the extra field information will be copied in extraField
|
||||||
|
(extraFieldBufferSize is the size of the buffer).
|
||||||
|
This is the Central-header version of the extra field
|
||||||
|
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||||
|
(commentBufferSize is the size of the buffer)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* for reading the content of the current zipfile, you can open it, read data
|
||||||
|
from it, and close it (you can close it before reading all the file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Open for reading data the current file in the zipfile.
|
||||||
|
If there is no error, the return value is UNZ_OK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Close the file in zip opened with unzOpenCurrentFile
|
||||||
|
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||||
|
voidp buf,
|
||||||
|
unsigned len));
|
||||||
|
/*
|
||||||
|
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||||
|
buf contain buffer where data must be copied
|
||||||
|
len the size of buf.
|
||||||
|
|
||||||
|
return the number of byte copied if somes bytes are copied
|
||||||
|
return 0 if the end of file was reached
|
||||||
|
return <0 with error code if there is an error
|
||||||
|
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Give the current position in uncompressed data
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzeof OF((unzFile file));
|
||||||
|
/*
|
||||||
|
return 1 if the end of file was reached, 0 elsewhere
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||||
|
voidp buf,
|
||||||
|
unsigned len));
|
||||||
|
/*
|
||||||
|
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||||
|
This is the local-header version of the extra field (sometimes, there is
|
||||||
|
more info in the local-header version than in the central-header)
|
||||||
|
|
||||||
|
if buf==NULL, it return the size of the local extra field
|
||||||
|
|
||||||
|
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||||
|
buf.
|
||||||
|
the return value is the number of bytes copied in buf, or (if <0)
|
||||||
|
the error code
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _unz_H */
|
Loading…
Reference in New Issue
Block a user