mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-13 22:35:10 +01:00
sound rendering test, updated DOS/Win32 ports
This commit is contained in:
parent
831c9642d3
commit
fefc260ec4
@ -196,6 +196,8 @@ int main (int argc, char *argv[])
|
|||||||
/* Emulation Loop */
|
/* Emulation Loop */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
ogc_audio__start();
|
||||||
|
|
||||||
/* Frame synchronization */
|
/* Frame synchronization */
|
||||||
if (gc_pal != vdp_pal)
|
if (gc_pal != vdp_pal)
|
||||||
{
|
{
|
||||||
@ -242,8 +244,8 @@ int main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* update video & audio */
|
/* update video & audio */
|
||||||
ogc_video__update();
|
|
||||||
ogc_audio__update();
|
ogc_audio__update();
|
||||||
|
ogc_video__update();
|
||||||
|
|
||||||
/* Check rendered frames (FPS) */
|
/* Check rendered frames (FPS) */
|
||||||
FrameCount++;
|
FrameCount++;
|
||||||
|
@ -51,11 +51,14 @@ void ogc_audio__init(void)
|
|||||||
{
|
{
|
||||||
AUDIO_Init (NULL);
|
AUDIO_Init (NULL);
|
||||||
AUDIO_SetDSPSampleRate (AI_SAMPLERATE_48KHZ);
|
AUDIO_SetDSPSampleRate (AI_SAMPLERATE_48KHZ);
|
||||||
AUDIO_RegisterDMACallback (AudioSwitchBuffers);
|
// AUDIO_RegisterDMACallback (AudioSwitchBuffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ogc_audio__reset(void)
|
void ogc_audio__reset(void)
|
||||||
{
|
{
|
||||||
|
IsPlaying = 0;
|
||||||
|
mixbuffer = 0;
|
||||||
|
playbuffer = 0;
|
||||||
memset(soundbuffer, 0, 16 * 3840);
|
memset(soundbuffer, 0, 16 * 3840);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,12 +66,27 @@ void ogc_audio__update(void)
|
|||||||
{
|
{
|
||||||
/* flush data from CPU cache */
|
/* flush data from CPU cache */
|
||||||
DCFlushRange(soundbuffer[mixbuffer], dma_len);
|
DCFlushRange(soundbuffer[mixbuffer], dma_len);
|
||||||
|
AUDIO_InitDMA((u32) soundbuffer[mixbuffer], dma_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ogc_audio__stop(void)
|
||||||
|
{
|
||||||
|
/* stop audio DMA */
|
||||||
|
AUDIO_StopDMA ();
|
||||||
|
AUDIO_InitDMA((u32) soundbuffer[0], dma_len);
|
||||||
|
IsPlaying = 0;
|
||||||
|
mixbuffer = 0;
|
||||||
|
playbuffer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ogc_audio__start(void)
|
||||||
|
{
|
||||||
if (!IsPlaying)
|
if (!IsPlaying)
|
||||||
{
|
{
|
||||||
dma_len = (vdp_pal) ? 3840 : 3200;
|
/* buffer size */
|
||||||
|
dma_len = vdp_pal ? 3840 : 3200;
|
||||||
|
|
||||||
/* set audio DMA parameters */
|
/* set default DMA parameters */
|
||||||
AUDIO_InitDMA((u32) soundbuffer[0], dma_len);
|
AUDIO_InitDMA((u32) soundbuffer[0], dma_len);
|
||||||
|
|
||||||
/* start audio DMA */
|
/* start audio DMA */
|
||||||
@ -77,13 +95,3 @@ void ogc_audio__update(void)
|
|||||||
IsPlaying = 1;
|
IsPlaying = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ogc_audio__stop(void)
|
|
||||||
{
|
|
||||||
/* stop audio DMA */
|
|
||||||
AUDIO_StopDMA ();
|
|
||||||
IsPlaying = 0;
|
|
||||||
mixbuffer = 0;
|
|
||||||
playbuffer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ extern int mixbuffer;
|
|||||||
extern void ogc_audio__init(void);
|
extern void ogc_audio__init(void);
|
||||||
extern void ogc_audio__reset(void);
|
extern void ogc_audio__reset(void);
|
||||||
extern void ogc_audio__stop(void);
|
extern void ogc_audio__stop(void);
|
||||||
|
extern void ogc_audio__start(void);
|
||||||
extern void ogc_audio__update(void);
|
extern void ogc_audio__update(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -396,9 +396,4 @@ static inline void audio_update (void)
|
|||||||
*sb++ = l;
|
*sb++ = l;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DOS
|
|
||||||
mixbuffer++;
|
|
||||||
mixbuffer &= 0xf;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,28 @@
|
|||||||
Genesis Plus History
|
Genesis Plus History
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
Note: All recent changes directly come from the Gamecube/Wii port, coded by Eke-Eke.
|
Note: All recent changes directly come from the GX (Gamecube/Wii) port, code by Eke-Eke.
|
||||||
|
|
||||||
|
|
||||||
|
[14/12/08] (Eke-Eke) version 1.3.0
|
||||||
|
-------------------
|
||||||
|
- YM2612 bugfixes (MAME core):
|
||||||
|
.fixed EG Decay->Substain transition when SL & DR are minimals: fix tracks #3 and #9 in "Mega Turrican"
|
||||||
|
.fixed a bug in SSG-EG emulation code: fix Level 1 music in "Alisia Dragoon"
|
||||||
|
.modified SSG-EG Decay End Level: fix some sound effects (ChainSaw, Zap...) in "Beavis & Butthead"
|
||||||
|
.improved Detune overflow accuracy: fix very high frequency sounds in many games
|
||||||
|
.fixed registers 0x20-0x26 Reset state: fix intro music in "B.O.B"
|
||||||
|
.reverted incorrect fix with KEY ON: fix "Flamethrower" sound effect in "Alien 3" and many others
|
||||||
|
- adjusted HCounter values: fixes line flickering in "Sonic 3D" bonus stage
|
||||||
|
- adjusted VINT timing: fixes hang-up in "V.R Troopers"
|
||||||
|
- improved HBLANK flag accuracy: fixes line flickering in "Gouketsuji Ichizoku"
|
||||||
|
- fixed broken Z80 access to WRAM: fixes hang-up in "Mamono Hunter Youko"
|
||||||
|
- modified JCART emulation: fixes corrupted tracks logo in "Micro Machines 2"
|
||||||
|
- added Blargg's NTSC Filters support (NTSC video artifacts emulation)
|
||||||
|
- optimized VDP rendering core, rewrote 68k interface (memory handlers, cycle execution, interrupts): greatly improved emulation speed
|
||||||
|
|
||||||
[08/26/08] (Eke-Eke)
|
[08/26/08] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- YM2612(MAME): fixed LFO phase update for CH3 special mode: fix sound effects in Warlock & Aladdin (thanks to AamirM)
|
- YM2612(MAME): fixed LFO phase update for CH3 special mode: fix sound effects in Warlock & Aladdin (thanks to AamirM)
|
||||||
- YM2612(MAME): fixed EG attenuation level on "KEY ON": fix Ecco 2's splash sound
|
- YM2612(MAME): fixed EG attenuation level on "KEY ON": fix Ecco 2's splash sound
|
||||||
- YM2612(MAME): fixed SSG-EG emulation: fix Bubba'n Stix (Track 5) and many others
|
- YM2612(MAME): fixed SSG-EG emulation: fix Bubba'n Stix (Track 5) and many others
|
||||||
@ -19,6 +38,7 @@ Note: All recent changes directly come from the Gamecube/Wii port, coded by Eke-
|
|||||||
- added Sega Mouse emulation (Populous 2, Body Count, Shangai 2, Fun'n Games, ...)
|
- added Sega Mouse emulation (Populous 2, Body Count, Shangai 2, Fun'n Games, ...)
|
||||||
|
|
||||||
[07/16/08] (Eke-Eke)
|
[07/16/08] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- adjusted (again) HINT timings: fix Double Dragon 2 (game freezed), hopefully does not break anything else
|
- adjusted (again) HINT timings: fix Double Dragon 2 (game freezed), hopefully does not break anything else
|
||||||
- fixed broken EEPROM support for Codemaster games
|
- fixed broken EEPROM support for Codemaster games
|
||||||
- modified input update timings: fix Dungeons & Dragons - Warriors of the Eternal Sun (thanks to Notaz)
|
- modified input update timings: fix Dungeons & Dragons - Warriors of the Eternal Sun (thanks to Notaz)
|
||||||
@ -33,22 +53,26 @@ Note: All recent changes directly come from the Gamecube/Wii port, coded by Eke-
|
|||||||
.implemented sample interpolation in MAME core to emulate the chip at original frequency (HQ YM2612 mode, from gens)
|
.implemented sample interpolation in MAME core to emulate the chip at original frequency (HQ YM2612 mode, from gens)
|
||||||
|
|
||||||
[06/01/08] (Eke-Eke)
|
[06/01/08] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- improved HCounter accuracy: fix graphic glitches in "Striker (Europe)"
|
- improved HCounter accuracy: fix graphic glitches in "Striker (Europe)"
|
||||||
- improved HINT timing accuracy: fix flickering in "Zero The Kamikaze Squirrel (USA)"
|
- improved HINT timing accuracy: fix flickering in "Zero The Kamikaze Squirrel (USA)"
|
||||||
- improved rendering accuracy when backdrop color is modified during HBLANK (Road Rash I/II/III)
|
- improved rendering accuracy when backdrop color is modified during HBLANK (Road Rash I/II/III)
|
||||||
- fixed broken Game Genie support
|
- fixed broken Game Genie support
|
||||||
|
|
||||||
[04/19/08] (Eke-Eke)
|
[04/19/08] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- modified VINT timings a little bit: fix lockup during Desert Strike's intro
|
- modified VINT timings a little bit: fix lockup during Desert Strike's intro
|
||||||
- corrected 68k interrupts handling: fix graphic glitches in Darius II/Sagaia
|
- corrected 68k interrupts handling: fix graphic glitches in Darius II/Sagaia
|
||||||
|
|
||||||
[04/06/08] (Eke-Eke)
|
[04/06/08] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- updated SVP core: fix some perspective issues in Virtua Racing (thanks to Notaz)
|
- updated SVP core: fix some perspective issues in Virtua Racing (thanks to Notaz)
|
||||||
- added internal SAT update during VRAM Fill: fix unmasked sprites during Battletech's intro
|
- added internal SAT update during VRAM Fill: fix unmasked sprites during Battletech's intro
|
||||||
- fixed m68k core issues with gcc 4.2.3: fix Xperts, Lemmings 2, M1 Abrams Battle Tank
|
- fixed m68k core issues with gcc 4.2.3: fix Xperts, Lemmings 2, M1 Abrams Battle Tank
|
||||||
- forced YM2612 Enveloppe update: fix intro music in Batman&Robin (thanks to Aamir)
|
- forced YM2612 Enveloppe update: fix intro music in Batman&Robin (thanks to Aamir)
|
||||||
|
|
||||||
[03/01/08] (Eke-Eke)
|
[03/01/08] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- added SVP emulation: Virtua Racing is now emulated (big thanks to Notaz and TascoDeluxe)
|
- added SVP emulation: Virtua Racing is now emulated (big thanks to Notaz and TascoDeluxe)
|
||||||
- fixed VDP registers behaviour when VDP Mode 4 is enabled: fix Bass Masters Classic Pro, Captain Planet & The Planeeters
|
- fixed VDP registers behaviour when VDP Mode 4 is enabled: fix Bass Masters Classic Pro, Captain Planet & The Planeeters
|
||||||
- corrected a bug in DMA Fill operation: fix James Pond 3, Rockman World/Megaman Willy Wars (corrupted VRAM)
|
- corrected a bug in DMA Fill operation: fix James Pond 3, Rockman World/Megaman Willy Wars (corrupted VRAM)
|
||||||
@ -59,6 +83,7 @@ Note: All recent changes directly come from the Gamecube/Wii port, coded by Eke-
|
|||||||
- reduced Savestate size
|
- reduced Savestate size
|
||||||
|
|
||||||
[01/07/08] (Eke-Eke)
|
[01/07/08] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- fixed interleaved rom detection: roms with .smd extension should now work fine
|
- fixed interleaved rom detection: roms with .smd extension should now work fine
|
||||||
- fixed a recently introduced bug in VDP registers writes: fixes bad colors in Toy Story (intro)
|
- fixed a recently introduced bug in VDP registers writes: fixes bad colors in Toy Story (intro)
|
||||||
- updated list of games using EEPROM: added Sports Talk Baseball (internal memory check fixed) and Brian Lara Cricket
|
- updated list of games using EEPROM: added Sports Talk Baseball (internal memory check fixed) and Brian Lara Cricket
|
||||||
@ -69,6 +94,7 @@ Note: All recent changes directly come from the Gamecube/Wii port, coded by Eke-
|
|||||||
- added support for custom ROM/RAM mapping used by Game no Kanzume Otokuyou
|
- added support for custom ROM/RAM mapping used by Game no Kanzume Otokuyou
|
||||||
|
|
||||||
[12/28/07] (Eke-Eke)
|
[12/28/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- many sourcecode cleanup and optimization
|
- many sourcecode cleanup and optimization
|
||||||
- completely rewrote EEPROM emulation: now support all known EEPROM types (24C01-24C65) and mappers (Sega, Acclaim, EA, Codemasters)
|
- completely rewrote EEPROM emulation: now support all known EEPROM types (24C01-24C65) and mappers (Sega, Acclaim, EA, Codemasters)
|
||||||
used in a few games (now use internal game database) as external RAM. This should at least fix save support in the following games:
|
used in a few games (now use internal game database) as external RAM. This should at least fix save support in the following games:
|
||||||
@ -99,6 +125,7 @@ used in a few games (now use internal game database) as external RAM. This shoul
|
|||||||
- added full overscan emulation (vertical & horizontal borders) for "pixel perfect" aspect ratio (tested against a real genesis)
|
- added full overscan emulation (vertical & horizontal borders) for "pixel perfect" aspect ratio (tested against a real genesis)
|
||||||
|
|
||||||
[07/20/07] (Eke-Eke)
|
[07/20/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- corrected TeamPlayer support: fix multiplayer in Gauntlet 4 (Sept. version), Pengo and a lot of others
|
- corrected TeamPlayer support: fix multiplayer in Gauntlet 4 (Sept. version), Pengo and a lot of others
|
||||||
- added J-Cart support: enable multiplayer in Codemasters games (Pete Sampras, Micromachines games, Super Skidmarks)
|
- added J-Cart support: enable multiplayer in Codemasters games (Pete Sampras, Micromachines games, Super Skidmarks)
|
||||||
- added serial EEPROM autodetection: fix games with bad SRAM informations in header (NBA Jam TE)
|
- added serial EEPROM autodetection: fix games with bad SRAM informations in header (NBA Jam TE)
|
||||||
@ -109,10 +136,12 @@ used in a few games (now use internal game database) as external RAM. This shoul
|
|||||||
in some games to enable special features or even complete the game (ex: X-Men).
|
in some games to enable special features or even complete the game (ex: X-Men).
|
||||||
|
|
||||||
[06/21/07] (Eke-Eke)
|
[06/21/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- added Multitap support (EA 4-Way Play and Sega Teamplayer): allowed up to four players in games supporting those peripherals
|
- added Multitap support (EA 4-Way Play and Sega Teamplayer): allowed up to four players in games supporting those peripherals
|
||||||
- added partial Sega Menacer lightgun support (use Analog Stick): automatically set when detecting the 6-in-1 Menacer game
|
- added partial Sega Menacer lightgun support (use Analog Stick): automatically set when detecting the 6-in-1 Menacer game
|
||||||
|
|
||||||
[05/18/07] (Eke-Eke)
|
[05/18/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- you can now switch between FM cores without reseting the game. FM registers value are automatically restored when switching.
|
- you can now switch between FM cores without reseting the game. FM registers value are automatically restored when switching.
|
||||||
- removed the previous VINT timings modification because it brokes some games (Rocket Knight, Thunderforce III,...)
|
- removed the previous VINT timings modification because it brokes some games (Rocket Knight, Thunderforce III,...)
|
||||||
- added automatic Timing configuration (VDP latency, VINT timing & alternate Line Timing) at game loading, based upon specific romname detection.
|
- added automatic Timing configuration (VDP latency, VINT timing & alternate Line Timing) at game loading, based upon specific romname detection.
|
||||||
@ -124,6 +153,7 @@ For information, games that are actually detected and need special timings to ru
|
|||||||
.Chaos Engine/Soldiers of Fortune (graphic glitches on scrolling)
|
.Chaos Engine/Soldiers of Fortune (graphic glitches on scrolling)
|
||||||
|
|
||||||
[05/08/07] (Eke-Eke)
|
[05/08/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- VINT timings are now a little more accurate: fixes Sesame's Street Counting Cafe
|
- VINT timings are now a little more accurate: fixes Sesame's Street Counting Cafe
|
||||||
- SN76496 MAX_OUTPUT back to normal
|
- SN76496 MAX_OUTPUT back to normal
|
||||||
- modified FB_WNOISE value in SN76496 core according to John Kortink's last informations
|
- modified FB_WNOISE value in SN76496 core according to John Kortink's last informations
|
||||||
@ -135,13 +165,16 @@ For information, games that are actually detected and need special timings to ru
|
|||||||
- added some other configurable sound options (boost overall volume, FM improvment for Gens YM2612)
|
- added some other configurable sound options (boost overall volume, FM improvment for Gens YM2612)
|
||||||
|
|
||||||
[04/11/07] (Eke-Eke)
|
[04/11/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- corrected MAX_OUTPUT value in SN76496 core: fix PSG sound (SFX) volume
|
- corrected MAX_OUTPUT value in SN76496 core: fix PSG sound (SFX) volume
|
||||||
|
|
||||||
[03/17/07] (Eke-Eke)
|
[03/17/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- added an option to enable alternate line rendering timing (fix single line error in Road Rash series and Legend of Galahad's Intro)
|
- added an option to enable alternate line rendering timing (fix single line error in Road Rash series and Legend of Galahad's Intro)
|
||||||
- Color RAM update now always reset color 0 to border color (fix color glitches in Mortal Kombat,...) (thanks to Noop's for the idea)
|
- Color RAM update now always reset color 0 to border color (fix color glitches in Mortal Kombat,...) (thanks to Noop's for the idea)
|
||||||
|
|
||||||
[03/09/07] (Eke-Eke)
|
[03/09/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- modified HV counter tables (fix graphic glitches in Skitchin's sky, Lotus 2 Recs, Panorama Cotton, Dashin Desperados & maybe more)
|
- modified HV counter tables (fix graphic glitches in Skitchin's sky, Lotus 2 Recs, Panorama Cotton, Dashin Desperados & maybe more)
|
||||||
- completely rewrote DMA timings emulation so that it works for all games (no more cpu freezing)
|
- completely rewrote DMA timings emulation so that it works for all games (no more cpu freezing)
|
||||||
- added all DMA tranfer rates handling for each three DMA modes and added dma busy flag emulation
|
- added all DMA tranfer rates handling for each three DMA modes and added dma busy flag emulation
|
||||||
@ -154,6 +187,7 @@ For information, games that are actually detected and need special timings to ru
|
|||||||
- modified sound mixing a bit according to Generator sourcecode (FM and PSG ratios seems more correct)
|
- modified sound mixing a bit according to Generator sourcecode (FM and PSG ratios seems more correct)
|
||||||
|
|
||||||
[02/07/07] (Eke-Eke)
|
[02/07/07] (Eke-Eke)
|
||||||
|
-------------------
|
||||||
- fixed fm timers (fix missing music in Castle of Illusion, Quackshot, Undead Line, Wonderboy in Monster Lair, Cal 50, Turbo Outrun, Thundeforce 4 and maybe more)
|
- fixed fm timers (fix missing music in Castle of Illusion, Quackshot, Undead Line, Wonderboy in Monster Lair, Cal 50, Turbo Outrun, Thundeforce 4 and maybe more)
|
||||||
- added complete EEPROM emulation (save support now works fine in Wonderboy5, Megaman Willy Wars, NBA Jam...) (credits to Notaz, adapted from Picodrive code)
|
- added complete EEPROM emulation (save support now works fine in Wonderboy5, Megaman Willy Wars, NBA Jam...) (credits to Notaz, adapted from Picodrive code)
|
||||||
- added preliminar dma timing emulation (fix bottom screen in Legend of Galahad) (credits to Notaz, adapted from Picodrive code)
|
- added preliminar dma timing emulation (fix bottom screen in Legend of Galahad) (credits to Notaz, adapted from Picodrive code)
|
||||||
@ -165,12 +199,15 @@ For information, games that are actually detected and need special timings to ru
|
|||||||
- modified dma fill operation for big endian platform (fix Contra Hardcorps gfx garbage)
|
- modified dma fill operation for big endian platform (fix Contra Hardcorps gfx garbage)
|
||||||
|
|
||||||
[05/25/03]
|
[05/25/03]
|
||||||
|
-------------------
|
||||||
- Fixed a typo that made Z80 banked access to the VDP registers always fail.
|
- Fixed a typo that made Z80 banked access to the VDP registers always fail.
|
||||||
|
|
||||||
[05/17/03]
|
[05/17/03]
|
||||||
|
-------------------
|
||||||
- Modified the rendering code to handle unaligned longword access to memory.
|
- Modified the rendering code to handle unaligned longword access to memory.
|
||||||
|
|
||||||
[04/20/03]
|
[04/20/03]
|
||||||
|
-------------------
|
||||||
- Modified 68000 emulator to prevent 'tas.b $mem' from writing data back
|
- Modified 68000 emulator to prevent 'tas.b $mem' from writing data back
|
||||||
after a read (fixes Gargoyles).
|
after a read (fixes Gargoyles).
|
||||||
- Fixed bug in 68000 emulator to swap order of words written for address
|
- Fixed bug in 68000 emulator to swap order of words written for address
|
||||||
@ -181,6 +218,7 @@ For information, games that are actually detected and need special timings to ru
|
|||||||
- Optimized sprite rendering inner loop.
|
- Optimized sprite rendering inner loop.
|
||||||
|
|
||||||
[04/13/03]
|
[04/13/03]
|
||||||
|
-------------------
|
||||||
- Finished up memory map for VDP DMA V-bus reads.
|
- Finished up memory map for VDP DMA V-bus reads.
|
||||||
- Fixed handling of 68000 writes to I/O chip at even addresses.
|
- Fixed handling of 68000 writes to I/O chip at even addresses.
|
||||||
- Fixed bit 7 handling of control register in I/O chip.
|
- Fixed bit 7 handling of control register in I/O chip.
|
||||||
@ -189,5 +227,6 @@ For information, games that are actually detected and need special timings to ru
|
|||||||
- Removed some faulty code from the 68000 memory map handlers.
|
- Removed some faulty code from the 68000 memory map handlers.
|
||||||
|
|
||||||
[03/22/03]
|
[03/22/03]
|
||||||
|
-------------------
|
||||||
- Completed implementation of Z80 banked memory handlers.
|
- Completed implementation of Z80 banked memory handlers.
|
||||||
|
|
||||||
|
@ -13,19 +13,19 @@ CC = gcc
|
|||||||
AS = nasm -f coff
|
AS = nasm -f coff
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
FLAGS = -I. -I.. -I../z80 -I../m68k -I../dos -I../sound -I../sound/SRC -I../cart_hw -I../cart_hw/svp \
|
FLAGS = -I. -I.. -I../z80 -I../m68k -I../dos -I../sound -I../sound/SRC -I../cart_hw -I../cart_hw/svp \
|
||||||
-Wall -g \
|
-Wall -g \
|
||||||
-O6 -march=i686 -fomit-frame-pointer \
|
-O6 -march=i686 -fomit-frame-pointer \
|
||||||
-DLSB_FIRST -DX86_ASM -DDOS
|
-DLSB_FIRST -DX86_ASM -DDOS
|
||||||
|
|
||||||
LIBS = -lalleg -laudio -lz -lm
|
LIBS = -lalleg -laudio -lz -lm
|
||||||
|
|
||||||
OBJ = obj/z80.o
|
OBJ = obj/z80.o
|
||||||
|
|
||||||
OBJ += obj/m68kcpu.o \
|
OBJ += obj/m68kcpu.o \
|
||||||
obj/m68kops.o
|
obj/m68kops.o
|
||||||
|
|
||||||
|
|
||||||
OBJ += obj/genesis.o \
|
OBJ += obj/genesis.o \
|
||||||
obj/vdp.o \
|
obj/vdp.o \
|
||||||
obj/render.o \
|
obj/render.o \
|
||||||
obj/system.o \
|
obj/system.o \
|
||||||
@ -34,10 +34,9 @@ OBJ += obj/genesis.o \
|
|||||||
obj/mem68k.o \
|
obj/mem68k.o \
|
||||||
obj/memz80.o \
|
obj/memz80.o \
|
||||||
obj/membnk.o \
|
obj/membnk.o \
|
||||||
obj/memvdp.o \
|
|
||||||
obj/state.o
|
obj/state.o
|
||||||
|
|
||||||
OBJ += obj/sound.o \
|
OBJ += obj/sound.o \
|
||||||
obj/fm.o \
|
obj/fm.o \
|
||||||
obj/sn76489.o \
|
obj/sn76489.o \
|
||||||
obj/ym2612.o
|
obj/ym2612.o
|
||||||
@ -48,7 +47,7 @@ OBJ += obj/samplerate.o \
|
|||||||
obj/src_sinc.o \
|
obj/src_sinc.o \
|
||||||
obj/src_zoh.o \
|
obj/src_zoh.o \
|
||||||
|
|
||||||
OBJ += obj/sram.o \
|
OBJ += obj/sram.o \
|
||||||
obj/eeprom.o \
|
obj/eeprom.o \
|
||||||
obj/svp.o \
|
obj/svp.o \
|
||||||
obj/ssp16.o \
|
obj/ssp16.o \
|
||||||
|
@ -16,273 +16,273 @@ static int master_volume = 256;
|
|||||||
|
|
||||||
void osd_update_audio(void)
|
void osd_update_audio(void)
|
||||||
{
|
{
|
||||||
if (seal_sample_rate == 0) return;
|
if (seal_sample_rate == 0) return;
|
||||||
AUpdateAudio();
|
AUpdateAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* attenuation in dB */
|
/* attenuation in dB */
|
||||||
void osd_set_mastervolume(int _attenuation)
|
void osd_set_mastervolume(int _attenuation)
|
||||||
{
|
{
|
||||||
float volume;
|
float volume;
|
||||||
|
|
||||||
attenuation = _attenuation;
|
attenuation = _attenuation;
|
||||||
|
|
||||||
volume = 256.0; /* range is 0-256 */
|
volume = 256.0; /* range is 0-256 */
|
||||||
while (_attenuation++ < 0)
|
while (_attenuation++ < 0)
|
||||||
volume /= 1.122018454; /* = (10 ^ (1/20)) = 1dB */
|
volume /= 1.122018454; /* = (10 ^ (1/20)) = 1dB */
|
||||||
|
|
||||||
master_volume = volume;
|
master_volume = volume;
|
||||||
|
|
||||||
ASetAudioMixerValue(AUDIO_MIXER_MASTER_VOLUME,master_volume);
|
ASetAudioMixerValue(AUDIO_MIXER_MASTER_VOLUME,master_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int msdos_init_sound(int *rate, int card)
|
int msdos_init_sound(int *rate, int card)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
seal_sample_rate = *rate;
|
seal_sample_rate = *rate;
|
||||||
seal_sound_card = card;
|
seal_sound_card = card;
|
||||||
|
|
||||||
if (AInitialize() != AUDIO_ERROR_NONE)
|
if (AInitialize() != AUDIO_ERROR_NONE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Ask the user if no sound card was chosen */
|
/* Ask the user if no sound card was chosen */
|
||||||
if (seal_sound_card == -1)
|
if (seal_sound_card == -1)
|
||||||
|
{
|
||||||
|
unsigned int k;
|
||||||
|
|
||||||
|
printf("\n SELECT YOUR AUDIO DEVICE :\n\n"
|
||||||
|
" AWE32/64 playback requires onboard DRAM,\n"
|
||||||
|
" Sound Blaster playback is the most compatible & better for emulation\n\n");
|
||||||
|
|
||||||
|
for (k = 0;k < AGetAudioNumDevs();k++)
|
||||||
{
|
{
|
||||||
unsigned int k;
|
if (AGetAudioDevCaps(k,&caps) == AUDIO_ERROR_NONE)
|
||||||
|
printf(" %2d. %s\n",k,caps.szProductName);
|
||||||
printf("\n SELECT YOUR AUDIO DEVICE :\n\n"
|
|
||||||
" AWE32/64 playback requires onboard DRAM,\n"
|
|
||||||
" Sound Blaster playback is the most compatible & better for emulation\n\n");
|
|
||||||
|
|
||||||
for (k = 0;k < AGetAudioNumDevs();k++)
|
|
||||||
{
|
|
||||||
if (AGetAudioDevCaps(k,&caps) == AUDIO_ERROR_NONE)
|
|
||||||
printf(" %2d. %s\n",k,caps.szProductName);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
if (k < 10)
|
|
||||||
{
|
|
||||||
i = getch();
|
|
||||||
seal_sound_card = i - '0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
scanf("%d",&seal_sound_card);
|
|
||||||
}
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
/* initialize SEAL audio library */
|
if (k < 10)
|
||||||
if (seal_sound_card == 0) /* silence */
|
|
||||||
{
|
{
|
||||||
/* update the Machine structure to show that sound is disabled */
|
i = getch();
|
||||||
seal_sample_rate = 0;
|
seal_sound_card = i - '0';
|
||||||
exit(0);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
scanf("%d",&seal_sound_card);
|
||||||
|
}
|
||||||
|
|
||||||
/* open audio device */
|
/* initialize SEAL audio library */
|
||||||
/* info.nDeviceId = AUDIO_DEVICE_MAPPER;*/
|
if (seal_sound_card == 0) /* silence */
|
||||||
info.nDeviceId = seal_sound_card;
|
{
|
||||||
/* always use 16 bit mixing if possible - better quality and same speed of 8 bit */
|
/* update the Machine structure to show that sound is disabled */
|
||||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO | AUDIO_FORMAT_RAW_SAMPLE;
|
seal_sample_rate = 0;
|
||||||
|
exit(0);
|
||||||
info.nSampleRate = seal_sample_rate;
|
|
||||||
if (AOpenAudio(&info) != AUDIO_ERROR_NONE)
|
|
||||||
{
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
AGetAudioDevCaps(info.nDeviceId,&caps);
|
|
||||||
printf("Using `%s' at %d-bit %s %u Hz\n",
|
|
||||||
caps.szProductName,
|
|
||||||
info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8,
|
|
||||||
info.wFormat & AUDIO_FORMAT_STEREO ? "stereo" : "mono",
|
|
||||||
info.nSampleRate);
|
|
||||||
|
|
||||||
/* open and allocate voices, allocate waveforms */
|
|
||||||
if (AOpenVoices(NUMVOICES) != AUDIO_ERROR_NONE)
|
|
||||||
{
|
|
||||||
printf("voices initialization failed\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < NUMVOICES; i++)
|
|
||||||
{
|
|
||||||
if (ACreateAudioVoice(&hVoice[i]) != AUDIO_ERROR_NONE)
|
|
||||||
{
|
|
||||||
printf("voice #%d creation failed\n",i);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASetVoicePanning(hVoice[i],128);
|
|
||||||
|
|
||||||
lpWave[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update the Machine structure to reflect the actual sample rate */
|
|
||||||
*rate = seal_sample_rate = info.nSampleRate;
|
|
||||||
|
|
||||||
{
|
|
||||||
uclock_t a,b;
|
|
||||||
LONG start,end;
|
|
||||||
|
|
||||||
|
|
||||||
if ((lpWave[0] = (LPAUDIOWAVE)malloc(sizeof(AUDIOWAVE))) == 0)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
lpWave[0]->wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO;
|
|
||||||
lpWave[0]->nSampleRate = seal_sample_rate;
|
|
||||||
lpWave[0]->dwLength = 3*seal_sample_rate;
|
|
||||||
lpWave[0]->dwLoopStart = 0;
|
|
||||||
lpWave[0]->dwLoopEnd = 3*seal_sample_rate;
|
|
||||||
if (ACreateAudioData(lpWave[0]) != AUDIO_ERROR_NONE)
|
|
||||||
{
|
|
||||||
free(lpWave[0]);
|
|
||||||
lpWave[0] = 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(lpWave[0]->lpData,0,3*seal_sample_rate);
|
|
||||||
/* upload the data to the audio DRAM local memory */
|
|
||||||
AWriteAudioData(lpWave[0],0,3*seal_sample_rate);
|
|
||||||
APrimeVoice(hVoice[0],lpWave[0]);
|
|
||||||
ASetVoiceFrequency(hVoice[0],seal_sample_rate);
|
|
||||||
ASetVoiceVolume(hVoice[0],0);
|
|
||||||
AStartVoice(hVoice[0]);
|
|
||||||
|
|
||||||
a = uclock();
|
|
||||||
/* wait some time to let everything stabilize */
|
|
||||||
do
|
|
||||||
{
|
|
||||||
osd_update_audio();
|
|
||||||
b = uclock();
|
|
||||||
} while (b-a < UCLOCKS_PER_SEC/10);
|
|
||||||
|
|
||||||
a = uclock();
|
|
||||||
AGetVoicePosition(hVoice[0],&start);
|
|
||||||
do
|
|
||||||
{
|
|
||||||
osd_update_audio();
|
|
||||||
b = uclock();
|
|
||||||
} while (b-a < UCLOCKS_PER_SEC);
|
|
||||||
AGetVoicePosition(hVoice[0],&end);
|
|
||||||
|
|
||||||
nominal_sample_rate = seal_sample_rate;
|
|
||||||
seal_sample_rate = end - start;
|
|
||||||
|
|
||||||
AStopVoice(hVoice[0]);
|
|
||||||
ADestroyAudioData(lpWave[0]);
|
|
||||||
free(lpWave[0]);
|
|
||||||
lpWave[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
osd_set_mastervolume(0); /* start at maximum volume */
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open audio device */
|
||||||
|
/* info.nDeviceId = AUDIO_DEVICE_MAPPER;*/
|
||||||
|
info.nDeviceId = seal_sound_card;
|
||||||
|
/* always use 16 bit mixing if possible - better quality and same speed of 8 bit */
|
||||||
|
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO | AUDIO_FORMAT_RAW_SAMPLE;
|
||||||
|
|
||||||
|
info.nSampleRate = seal_sample_rate;
|
||||||
|
if (AOpenAudio(&info) != AUDIO_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
AGetAudioDevCaps(info.nDeviceId,&caps);
|
||||||
|
printf("Using `%s' at %d-bit %s %u Hz\n",
|
||||||
|
caps.szProductName,
|
||||||
|
info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8,
|
||||||
|
info.wFormat & AUDIO_FORMAT_STEREO ? "stereo" : "mono",
|
||||||
|
info.nSampleRate);
|
||||||
|
|
||||||
|
/* open and allocate voices, allocate waveforms */
|
||||||
|
if (AOpenVoices(NUMVOICES) != AUDIO_ERROR_NONE)
|
||||||
|
{
|
||||||
|
printf("voices initialization failed\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < NUMVOICES; i++)
|
||||||
|
{
|
||||||
|
if (ACreateAudioVoice(&hVoice[i]) != AUDIO_ERROR_NONE)
|
||||||
|
{
|
||||||
|
printf("voice #%d creation failed\n",i);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASetVoicePanning(hVoice[i],128);
|
||||||
|
|
||||||
|
lpWave[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update the Machine structure to reflect the actual sample rate */
|
||||||
|
*rate = seal_sample_rate = info.nSampleRate;
|
||||||
|
|
||||||
|
{
|
||||||
|
uclock_t a,b;
|
||||||
|
LONG start,end;
|
||||||
|
|
||||||
|
|
||||||
|
if ((lpWave[0] = (LPAUDIOWAVE)malloc(sizeof(AUDIOWAVE))) == 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
lpWave[0]->wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO;
|
||||||
|
lpWave[0]->nSampleRate = seal_sample_rate;
|
||||||
|
lpWave[0]->dwLength = 3*seal_sample_rate;
|
||||||
|
lpWave[0]->dwLoopStart = 0;
|
||||||
|
lpWave[0]->dwLoopEnd = 3*seal_sample_rate;
|
||||||
|
if (ACreateAudioData(lpWave[0]) != AUDIO_ERROR_NONE)
|
||||||
|
{
|
||||||
|
free(lpWave[0]);
|
||||||
|
lpWave[0] = 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(lpWave[0]->lpData,0,3*seal_sample_rate);
|
||||||
|
/* upload the data to the audio DRAM local memory */
|
||||||
|
AWriteAudioData(lpWave[0],0,3*seal_sample_rate);
|
||||||
|
APrimeVoice(hVoice[0],lpWave[0]);
|
||||||
|
ASetVoiceFrequency(hVoice[0],seal_sample_rate);
|
||||||
|
ASetVoiceVolume(hVoice[0],0);
|
||||||
|
AStartVoice(hVoice[0]);
|
||||||
|
|
||||||
|
a = uclock();
|
||||||
|
/* wait some time to let everything stabilize */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
osd_update_audio();
|
||||||
|
b = uclock();
|
||||||
|
} while (b-a < UCLOCKS_PER_SEC/10);
|
||||||
|
|
||||||
|
a = uclock();
|
||||||
|
AGetVoicePosition(hVoice[0],&start);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
osd_update_audio();
|
||||||
|
b = uclock();
|
||||||
|
} while (b-a < UCLOCKS_PER_SEC);
|
||||||
|
AGetVoicePosition(hVoice[0],&end);
|
||||||
|
|
||||||
|
nominal_sample_rate = seal_sample_rate;
|
||||||
|
seal_sample_rate = end - start;
|
||||||
|
|
||||||
|
AStopVoice(hVoice[0]);
|
||||||
|
ADestroyAudioData(lpWave[0]);
|
||||||
|
free(lpWave[0]);
|
||||||
|
lpWave[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
osd_set_mastervolume(0); /* start at maximum volume */
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void msdos_shutdown_sound(void)
|
void msdos_shutdown_sound(void)
|
||||||
{
|
{
|
||||||
if (seal_sample_rate != 0)
|
if (seal_sample_rate != 0)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* stop and release voices */
|
/* stop and release voices */
|
||||||
for (n = 0; n < NUMVOICES; n++)
|
for (n = 0; n < NUMVOICES; n++)
|
||||||
{
|
{
|
||||||
AStopVoice(hVoice[n]);
|
AStopVoice(hVoice[n]);
|
||||||
ADestroyAudioVoice(hVoice[n]);
|
ADestroyAudioVoice(hVoice[n]);
|
||||||
if (lpWave[n])
|
if (lpWave[n])
|
||||||
{
|
{
|
||||||
ADestroyAudioData(lpWave[n]);
|
ADestroyAudioData(lpWave[n]);
|
||||||
free(lpWave[n]);
|
free(lpWave[n]);
|
||||||
lpWave[n] = 0;
|
lpWave[n] = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ACloseVoices();
|
|
||||||
ACloseAudio();
|
|
||||||
}
|
}
|
||||||
|
ACloseVoices();
|
||||||
|
ACloseAudio();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void playstreamedsample(int channel,signed char *data,int len,int freq,int volume,int pan,int bits)
|
void playstreamedsample(int channel,signed char *data,int len,int freq,int volume,int pan,int bits)
|
||||||
{
|
{
|
||||||
static int playing[NUMVOICES];
|
static int playing[NUMVOICES];
|
||||||
static int c[NUMVOICES];
|
static int c[NUMVOICES];
|
||||||
|
|
||||||
/* backwards compatibility with old 0-255 volume range */
|
/* backwards compatibility with old 0-255 volume range */
|
||||||
if (volume > 100) volume = volume * 25 / 255;
|
if (volume > 100) volume = volume * 25 / 255;
|
||||||
|
|
||||||
if (seal_sample_rate == 0 || channel >= NUMVOICES) return;
|
if (seal_sample_rate == 0 || channel >= NUMVOICES) return;
|
||||||
|
|
||||||
if (!playing[channel])
|
if (!playing[channel])
|
||||||
|
{
|
||||||
|
if (lpWave[channel])
|
||||||
{
|
{
|
||||||
if (lpWave[channel])
|
AStopVoice(hVoice[channel]);
|
||||||
{
|
ADestroyAudioData(lpWave[channel]);
|
||||||
AStopVoice(hVoice[channel]);
|
free(lpWave[channel]);
|
||||||
ADestroyAudioData(lpWave[channel]);
|
lpWave[channel] = 0;
|
||||||
free(lpWave[channel]);
|
}
|
||||||
lpWave[channel] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((lpWave[channel] = (LPAUDIOWAVE)malloc(sizeof(AUDIOWAVE))) == 0)
|
if ((lpWave[channel] = (LPAUDIOWAVE)malloc(sizeof(AUDIOWAVE))) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lpWave[channel]->wFormat = (bits == 8 ? AUDIO_FORMAT_8BITS : AUDIO_FORMAT_16BITS)
|
lpWave[channel]->wFormat = (bits == 8 ? AUDIO_FORMAT_8BITS : AUDIO_FORMAT_16BITS)
|
||||||
| AUDIO_FORMAT_MONO | AUDIO_FORMAT_LOOP;
|
| AUDIO_FORMAT_MONO | AUDIO_FORMAT_LOOP;
|
||||||
lpWave[channel]->nSampleRate = nominal_sample_rate;
|
lpWave[channel]->nSampleRate = nominal_sample_rate;
|
||||||
lpWave[channel]->dwLength = 3*len;
|
lpWave[channel]->dwLength = 3*len;
|
||||||
lpWave[channel]->dwLoopStart = 0;
|
lpWave[channel]->dwLoopStart = 0;
|
||||||
lpWave[channel]->dwLoopEnd = 3*len;
|
lpWave[channel]->dwLoopEnd = 3*len;
|
||||||
if (ACreateAudioData(lpWave[channel]) != AUDIO_ERROR_NONE)
|
if (ACreateAudioData(lpWave[channel]) != AUDIO_ERROR_NONE)
|
||||||
{
|
{
|
||||||
free(lpWave[channel]);
|
free(lpWave[channel]);
|
||||||
lpWave[channel] = 0;
|
lpWave[channel] = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
memset(lpWave[channel]->lpData,0,3*len);
|
||||||
}
|
memcpy(lpWave[channel]->lpData,data,len);
|
||||||
|
|
||||||
|
/* upload the data to the audio DRAM local memory */
|
||||||
|
AWriteAudioData(lpWave[channel],0,3*len);
|
||||||
|
APrimeVoice(hVoice[channel],lpWave[channel]);
|
||||||
|
|
||||||
memset(lpWave[channel]->lpData,0,3*len);
|
|
||||||
memcpy(lpWave[channel]->lpData,data,len);
|
|
||||||
/* upload the data to the audio DRAM local memory */
|
|
||||||
AWriteAudioData(lpWave[channel],0,3*len);
|
|
||||||
APrimeVoice(hVoice[channel],lpWave[channel]);
|
|
||||||
/* need to cast to double because freq*nominal_sample_rate can exceed the size of an int */
|
/* need to cast to double because freq*nominal_sample_rate can exceed the size of an int */
|
||||||
ASetVoiceFrequency(hVoice[channel],(double)freq*nominal_sample_rate/seal_sample_rate);
|
ASetVoiceFrequency(hVoice[channel],(double)freq*nominal_sample_rate/seal_sample_rate);
|
||||||
AStartVoice(hVoice[channel]);
|
AStartVoice(hVoice[channel]);
|
||||||
playing[channel] = 1;
|
playing[channel] = 1;
|
||||||
c[channel] = 1;
|
c[channel] = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
LONG pos;
|
||||||
|
|
||||||
|
for(;;)
|
||||||
{
|
{
|
||||||
LONG pos;
|
AGetVoicePosition(hVoice[channel],&pos);
|
||||||
|
if (c[channel] == 0 && pos >= len) break;
|
||||||
for(;;)
|
if (c[channel] == 1 && (pos < len || pos >= 2*len)) break;
|
||||||
{
|
if (c[channel] == 2 && pos < 2*len) break;
|
||||||
AGetVoicePosition(hVoice[channel],&pos);
|
osd_update_audio();
|
||||||
if (c[channel] == 0 && pos >= len) break;
|
|
||||||
if (c[channel] == 1 && (pos < len || pos >= 2*len)) break;
|
|
||||||
if (c[channel] == 2 && pos < 2*len) break;
|
|
||||||
osd_update_audio();
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&lpWave[channel]->lpData[len * c[channel]],data,len);
|
|
||||||
AWriteAudioData(lpWave[channel],len*c[channel],len);
|
|
||||||
c[channel]++;
|
|
||||||
if (c[channel] == 3) c[channel] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(&lpWave[channel]->lpData[len * c[channel]],data,len);
|
||||||
|
AWriteAudioData(lpWave[channel],len*c[channel],len);
|
||||||
|
c[channel]++;
|
||||||
|
if (c[channel] == 3) c[channel] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ASetVoiceVolume(hVoice[channel],volume * 64 / 100);
|
ASetVoiceVolume(hVoice[channel],volume * 64 / 100);
|
||||||
ASetVoicePanning(hVoice[channel],(pan + 100) * 255 / 200);
|
ASetVoicePanning(hVoice[channel],(pan + 100) * 255 / 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
void osd_play_streamed_sample_16(int channel,signed short *data,int len,int freq,int volume,int pan)
|
void osd_play_streamed_sample_16(int channel,signed short *data,int len,int freq,int volume,int pan)
|
||||||
{
|
{
|
||||||
playstreamedsample(channel,(signed char *)data,len,freq,volume,pan,16);
|
playstreamedsample(channel,(signed char *)data,len,freq,volume,pan,16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,34 +67,34 @@ int main (int argc, char *argv[])
|
|||||||
error_init();
|
error_init();
|
||||||
|
|
||||||
cart_rom = malloc(0xA00000);
|
cart_rom = malloc(0xA00000);
|
||||||
memset(cart_rom, 0, 0xA00000);
|
memset(cart_rom, 0, 0xA00000);
|
||||||
|
|
||||||
if(!load_rom(argv[1]))
|
if(!load_rom(argv[1]))
|
||||||
{
|
{
|
||||||
printf("File `%s' not found.\n", argv[1]);
|
printf("File `%s' not found.\n", argv[1]);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* load BIOS */
|
/* load BIOS */
|
||||||
memset(bios_rom, 0, sizeof(bios_rom));
|
memset(bios_rom, 0, sizeof(bios_rom));
|
||||||
FILE *f = fopen("./BIOS.bin", "rb");
|
FILE *f = fopen("./BIOS.bin", "rb");
|
||||||
if (f!=NULL)
|
if (f!=NULL)
|
||||||
{
|
{
|
||||||
fread(&bios_rom, 0x800,1,f);
|
fread(&bios_rom, 0x800,1,f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < 0x800; i += 2)
|
for(i = 0; i < 0x800; i += 2)
|
||||||
{
|
{
|
||||||
uint8 temp = bios_rom[i];
|
uint8 temp = bios_rom[i];
|
||||||
bios_rom[i] = bios_rom[i+1];
|
bios_rom[i] = bios_rom[i+1];
|
||||||
bios_rom[i+1] = temp;
|
bios_rom[i+1] = temp;
|
||||||
}
|
}
|
||||||
config.bios_enabled |= 2;
|
config.bios_enabled |= 2;
|
||||||
}
|
}
|
||||||
else config.bios_enabled = 0;
|
else config.bios_enabled = 0;
|
||||||
|
|
||||||
/* initialize genesis VM */
|
/* initialize genesis VM */
|
||||||
init_machine();
|
init_machine();
|
||||||
|
|
||||||
/* default config */
|
/* default config */
|
||||||
@ -103,16 +103,16 @@ int main (int argc, char *argv[])
|
|||||||
input.system[0] = SYSTEM_GAMEPAD;
|
input.system[0] = SYSTEM_GAMEPAD;
|
||||||
input.system[1] = SYSTEM_GAMEPAD;
|
input.system[1] = SYSTEM_GAMEPAD;
|
||||||
|
|
||||||
/* initialize emulation */
|
/* initialize emulation */
|
||||||
system_init();
|
system_init();
|
||||||
audio_init(option.sndrate);
|
audio_init(option.sndrate);
|
||||||
|
|
||||||
f = fopen("./game.srm", "rb");
|
f = fopen("./game.srm", "rb");
|
||||||
if (f!=NULL)
|
if (f!=NULL)
|
||||||
{
|
{
|
||||||
fread(&sram.sram,0x10000,1, f);
|
fread(&sram.sram,0x10000,1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset emulation */
|
/* reset emulation */
|
||||||
system_reset();
|
system_reset();
|
||||||
@ -120,27 +120,28 @@ int main (int argc, char *argv[])
|
|||||||
/* emulation loop */
|
/* emulation loop */
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
dos_update_input();
|
||||||
frame_count += 1;
|
frame_count += 1;
|
||||||
if(quit) break;
|
if(quit) break;
|
||||||
if(frame_count % frame_skip == 0)
|
if(frame_count % frame_skip == 0)
|
||||||
{
|
{
|
||||||
system_frame(0);
|
system_frame(0);
|
||||||
frames_rendered++;
|
frames_rendered++;
|
||||||
dos_update_video();
|
dos_update_video();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
system_frame(1);
|
system_frame(1,reset_line);
|
||||||
}
|
}
|
||||||
if(option.sound) dos_update_audio();
|
if(option.sound) dos_update_audio();
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen("./game.srm", "wb");
|
f = fopen("./game.srm", "wb");
|
||||||
if (f!=NULL)
|
if (f!=NULL)
|
||||||
{
|
{
|
||||||
fwrite(&sram.sram, 0x10000,1,f);
|
fwrite(&sram.sram, 0x10000,1,f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
trash_machine();
|
trash_machine();
|
||||||
system_shutdown();
|
system_shutdown();
|
||||||
@ -153,130 +154,129 @@ int main (int argc, char *argv[])
|
|||||||
/* Timer handler */
|
/* Timer handler */
|
||||||
void tick_handler(void)
|
void tick_handler(void)
|
||||||
{
|
{
|
||||||
tick_count += 1;
|
tick_count += 1;
|
||||||
if(tick_count % FRAMES_PER_SECOND == 0)
|
if(tick_count % FRAMES_PER_SECOND == 0)
|
||||||
{
|
{
|
||||||
frame_rate = frames_rendered;
|
frame_rate = frames_rendered;
|
||||||
frames_rendered = 0;
|
frames_rendered = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_OF_FUNCTION(tick_handler);
|
END_OF_FUNCTION(tick_handler);
|
||||||
|
|
||||||
|
|
||||||
int load_file(char *filename, char *buf, int size)
|
int load_file(char *filename, char *buf, int size)
|
||||||
{
|
{
|
||||||
FILE *fd = fopen(filename, "rb");
|
FILE *fd = fopen(filename, "rb");
|
||||||
if(!fd) return (0);
|
if(!fd) return (0);
|
||||||
fread(buf, size, 1, fd);
|
fread(buf, size, 1, fd);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int save_file(char *filename, char *buf, int size)
|
int save_file(char *filename, char *buf, int size)
|
||||||
{
|
{
|
||||||
FILE *fd = NULL;
|
FILE *fd = NULL;
|
||||||
if(!(fd = fopen(filename, "wb"))) return (0);
|
if(!(fd = fopen(filename, "wb"))) return (0);
|
||||||
fwrite(buf, size, 1, fd);
|
fwrite(buf, size, 1, fd);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int joynum = 0;
|
static int joynum = 0;
|
||||||
|
|
||||||
void dos_update_input(void)
|
void dos_update_input(void)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
if(key[KEY_ESC] || key[KEY_END])
|
if(key[KEY_ESC] || key[KEY_END])
|
||||||
{
|
{
|
||||||
quit = 1;
|
quit = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (input.dev[joynum] == NO_DEVICE)
|
while (input.dev[joynum] == NO_DEVICE)
|
||||||
{
|
{
|
||||||
joynum ++;
|
joynum ++;
|
||||||
if (joynum > MAX_DEVICES - 1) joynum = 0;
|
if (joynum > MAX_DEVICES - 1) joynum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(check_key(KEY_F11))
|
if(check_key(KEY_F11))
|
||||||
{
|
{
|
||||||
|
joynum ++;
|
||||||
|
if (joynum > MAX_DEVICES - 1) joynum = 0;
|
||||||
|
|
||||||
joynum ++;
|
while (input.dev[joynum] == NO_DEVICE)
|
||||||
if (joynum > MAX_DEVICES - 1) joynum = 0;
|
|
||||||
|
|
||||||
while (input.dev[joynum] == NO_DEVICE)
|
|
||||||
{
|
|
||||||
joynum ++;
|
|
||||||
if (joynum > MAX_DEVICES - 1) joynum = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
input.pad[joynum] = 0;
|
|
||||||
|
|
||||||
/* Is the joystick being used ? */
|
|
||||||
if(option.joy_driver != JOY_TYPE_NONE)
|
|
||||||
{
|
{
|
||||||
poll_joystick();
|
joynum ++;
|
||||||
|
if (joynum > MAX_DEVICES - 1) joynum = 0;
|
||||||
/* Check player 1 joystick */
|
|
||||||
if(joy[0].stick[0].axis[1].d1) input.pad[0] |= INPUT_UP;
|
|
||||||
else
|
|
||||||
if(joy[0].stick[0].axis[1].d2) input.pad[0] |= INPUT_DOWN;
|
|
||||||
|
|
||||||
if(joy[0].stick[0].axis[0].d1) input.pad[0] |= INPUT_LEFT;
|
|
||||||
else
|
|
||||||
if(joy[0].stick[0].axis[0].d2) input.pad[0] |= INPUT_RIGHT;
|
|
||||||
|
|
||||||
if(joy[0].button[0].b) input.pad[0] |= INPUT_A;
|
|
||||||
if(joy[0].button[1].b) input.pad[0] |= INPUT_B;
|
|
||||||
if(joy[0].button[2].b) input.pad[0] |= INPUT_C;
|
|
||||||
if(joy[0].button[3].b) input.pad[0] |= INPUT_START;
|
|
||||||
if(joy[0].button[4].b) input.pad[0] |= INPUT_X;
|
|
||||||
if(joy[0].button[5].b) input.pad[0] |= INPUT_Y;
|
|
||||||
if(joy[0].button[6].b) input.pad[0] |= INPUT_Z;
|
|
||||||
if(joy[0].button[7].b) input.pad[0] |= INPUT_MODE;
|
|
||||||
|
|
||||||
/* More than one joystick supported ? */
|
|
||||||
if(num_joysticks > 2)
|
|
||||||
{
|
|
||||||
/* Check player 2 joystick */
|
|
||||||
if(joy[1].stick[0].axis[1].d1) input.pad[1] |= INPUT_UP;
|
|
||||||
else
|
|
||||||
if(joy[1].stick[0].axis[1].d2) input.pad[1] |= INPUT_DOWN;
|
|
||||||
|
|
||||||
if(joy[1].stick[0].axis[0].d1) input.pad[1] |= INPUT_LEFT;
|
|
||||||
else
|
|
||||||
if(joy[1].stick[0].axis[0].d1) input.pad[1] |= INPUT_RIGHT;
|
|
||||||
|
|
||||||
if(joy[1].button[0].b) input.pad[1] |= INPUT_A;
|
|
||||||
if(joy[1].button[1].b) input.pad[1] |= INPUT_B;
|
|
||||||
if(joy[1].button[2].b) input.pad[1] |= INPUT_C;
|
|
||||||
if(joy[1].button[3].b) input.pad[1] |= INPUT_START;
|
|
||||||
if(joy[1].button[4].b) input.pad[1] |= INPUT_X;
|
|
||||||
if(joy[1].button[5].b) input.pad[1] |= INPUT_Y;
|
|
||||||
if(joy[1].button[6].b) input.pad[1] |= INPUT_Z;
|
|
||||||
if(joy[1].button[7].b) input.pad[1] |= INPUT_MODE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* keyboard */
|
input.pad[joynum] = 0;
|
||||||
if(key[KEY_UP]) input.pad[joynum] |= INPUT_UP;
|
|
||||||
else
|
|
||||||
if(key[KEY_DOWN]) input.pad[joynum] |= INPUT_DOWN;
|
|
||||||
|
|
||||||
if(key[KEY_LEFT]) input.pad[joynum] |= INPUT_LEFT;
|
/* Is the joystick being used ? */
|
||||||
else
|
if(option.joy_driver != JOY_TYPE_NONE)
|
||||||
if(key[KEY_RIGHT]) input.pad[joynum] |= INPUT_RIGHT;
|
{
|
||||||
|
poll_joystick();
|
||||||
|
|
||||||
if(key[KEY_A]) input.pad[joynum] |= INPUT_A;
|
/* Check player 1 joystick */
|
||||||
if(key[KEY_S]) input.pad[joynum] |= INPUT_B;
|
if(joy[0].stick[0].axis[1].d1) input.pad[0] |= INPUT_UP;
|
||||||
if(key[KEY_D]) input.pad[joynum] |= INPUT_C;
|
else
|
||||||
|
if(joy[0].stick[0].axis[1].d2) input.pad[0] |= INPUT_DOWN;
|
||||||
|
|
||||||
|
if(joy[0].stick[0].axis[0].d1) input.pad[0] |= INPUT_LEFT;
|
||||||
|
else
|
||||||
|
if(joy[0].stick[0].axis[0].d2) input.pad[0] |= INPUT_RIGHT;
|
||||||
|
|
||||||
|
if(joy[0].button[0].b) input.pad[0] |= INPUT_A;
|
||||||
|
if(joy[0].button[1].b) input.pad[0] |= INPUT_B;
|
||||||
|
if(joy[0].button[2].b) input.pad[0] |= INPUT_C;
|
||||||
|
if(joy[0].button[3].b) input.pad[0] |= INPUT_START;
|
||||||
|
if(joy[0].button[4].b) input.pad[0] |= INPUT_X;
|
||||||
|
if(joy[0].button[5].b) input.pad[0] |= INPUT_Y;
|
||||||
|
if(joy[0].button[6].b) input.pad[0] |= INPUT_Z;
|
||||||
|
if(joy[0].button[7].b) input.pad[0] |= INPUT_MODE;
|
||||||
|
|
||||||
|
/* More than one joystick supported ? */
|
||||||
|
if(num_joysticks > 2)
|
||||||
|
{
|
||||||
|
/* Check player 2 joystick */
|
||||||
|
if(joy[1].stick[0].axis[1].d1) input.pad[1] |= INPUT_UP;
|
||||||
|
else
|
||||||
|
if(joy[1].stick[0].axis[1].d2) input.pad[1] |= INPUT_DOWN;
|
||||||
|
|
||||||
|
if(joy[1].stick[0].axis[0].d1) input.pad[1] |= INPUT_LEFT;
|
||||||
|
else
|
||||||
|
if(joy[1].stick[0].axis[0].d1) input.pad[1] |= INPUT_RIGHT;
|
||||||
|
|
||||||
|
if(joy[1].button[0].b) input.pad[1] |= INPUT_A;
|
||||||
|
if(joy[1].button[1].b) input.pad[1] |= INPUT_B;
|
||||||
|
if(joy[1].button[2].b) input.pad[1] |= INPUT_C;
|
||||||
|
if(joy[1].button[3].b) input.pad[1] |= INPUT_START;
|
||||||
|
if(joy[1].button[4].b) input.pad[1] |= INPUT_X;
|
||||||
|
if(joy[1].button[5].b) input.pad[1] |= INPUT_Y;
|
||||||
|
if(joy[1].button[6].b) input.pad[1] |= INPUT_Z;
|
||||||
|
if(joy[1].button[7].b) input.pad[1] |= INPUT_MODE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* keyboard */
|
||||||
|
if(key[KEY_UP]) input.pad[joynum] |= INPUT_UP;
|
||||||
|
else
|
||||||
|
if(key[KEY_DOWN]) input.pad[joynum] |= INPUT_DOWN;
|
||||||
|
|
||||||
|
if(key[KEY_LEFT]) input.pad[joynum] |= INPUT_LEFT;
|
||||||
|
else
|
||||||
|
if(key[KEY_RIGHT]) input.pad[joynum] |= INPUT_RIGHT;
|
||||||
|
|
||||||
|
if(key[KEY_A]) input.pad[joynum] |= INPUT_A;
|
||||||
|
if(key[KEY_S]) input.pad[joynum] |= INPUT_B;
|
||||||
|
if(key[KEY_D]) input.pad[joynum] |= INPUT_C;
|
||||||
if(key[KEY_Z]) input.pad[joynum] |= INPUT_X;
|
if(key[KEY_Z]) input.pad[joynum] |= INPUT_X;
|
||||||
if(key[KEY_X]) input.pad[joynum] |= INPUT_Y;
|
if(key[KEY_X]) input.pad[joynum] |= INPUT_Y;
|
||||||
if(key[KEY_C]) input.pad[joynum] |= INPUT_Z;
|
if(key[KEY_C]) input.pad[joynum] |= INPUT_Z;
|
||||||
if(key[KEY_V]) input.pad[joynum] |= INPUT_MODE;
|
if(key[KEY_V]) input.pad[joynum] |= INPUT_MODE;
|
||||||
|
|
||||||
if(key[KEY_F]) input.pad[joynum] |= INPUT_START;
|
if(key[KEY_F]) input.pad[joynum] |= INPUT_START;
|
||||||
|
|
||||||
extern uint8 pico_current;
|
extern uint8 pico_current;
|
||||||
if (input.dev[joynum] == DEVICE_LIGHTGUN)
|
if (input.dev[joynum] == DEVICE_LIGHTGUN)
|
||||||
@ -297,79 +297,78 @@ void dos_update_input(void)
|
|||||||
else if (input.dev[joynum] == DEVICE_MOUSE)
|
else if (input.dev[joynum] == DEVICE_MOUSE)
|
||||||
{
|
{
|
||||||
/* Poll mouse if necessary */
|
/* Poll mouse if necessary */
|
||||||
if(mouse_needs_poll() == TRUE)
|
if(mouse_needs_poll() == TRUE)
|
||||||
poll_mouse();
|
poll_mouse();
|
||||||
|
|
||||||
/* Get X & Y quantity of movement */
|
/* Get X & Y quantity of movement */
|
||||||
get_mouse_mickeys(&input.analog[2][0], &input.analog[2][1]);
|
get_mouse_mickeys(&input.analog[2][0], &input.analog[2][1]);
|
||||||
|
|
||||||
/* Sega Mouse range is -256;+256 */
|
/* Sega Mouse range is -256;+256 */
|
||||||
input.analog[2][0] = (input.analog[2][0] * 256) / SCREEN_W;
|
input.analog[2][0] = (input.analog[2][0] * 256) / SCREEN_W;
|
||||||
input.analog[2][1] = (input.analog[2][1] * 256) / SCREEN_H;
|
input.analog[2][1] = (input.analog[2][1] * 256) / SCREEN_H;
|
||||||
|
|
||||||
/* Vertical movement is upsidedown */
|
/* Vertical movement is upsidedown */
|
||||||
if (!config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1];
|
if (!config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1];
|
||||||
|
|
||||||
/* Map mouse buttons to player #1 inputs */
|
/* Map mouse buttons to player #1 inputs */
|
||||||
if(mouse_b & 4) input.pad[joynum] |= INPUT_C;
|
if(mouse_b & 4) input.pad[joynum] |= INPUT_C;
|
||||||
if(mouse_b & 1) input.pad[joynum] |= INPUT_B;
|
if(mouse_b & 1) input.pad[joynum] |= INPUT_B;
|
||||||
if(mouse_b & 2) input.pad[joynum] |= INPUT_A;
|
if(mouse_b & 2) input.pad[joynum] |= INPUT_A;
|
||||||
}
|
}
|
||||||
else if (system_hw == SYSTEM_PICO)
|
else if (system_hw == SYSTEM_PICO)
|
||||||
{
|
{
|
||||||
/* Poll mouse if necessary */
|
/* Poll mouse if necessary */
|
||||||
if(mouse_needs_poll() == TRUE)
|
if(mouse_needs_poll() == TRUE)
|
||||||
poll_mouse();
|
poll_mouse();
|
||||||
|
|
||||||
/* Calculate X Y axis values */
|
/* Calculate X Y axis values */
|
||||||
input.analog[0][0] = 0x3c + (mouse_x * (0x17c-0x03c+1)) / SCREEN_W;
|
input.analog[0][0] = 0x3c + (mouse_x * (0x17c-0x03c+1)) / SCREEN_W;
|
||||||
input.analog[0][1] = 0x1fc + (mouse_y * (0x2f7-0x1fc+1)) / SCREEN_H;
|
input.analog[0][1] = 0x1fc + (mouse_y * (0x2f7-0x1fc+1)) / SCREEN_H;
|
||||||
|
|
||||||
/* Map mouse buttons to player #1 inputs */
|
/* Map mouse buttons to player #1 inputs */
|
||||||
if(mouse_b & 2) input.pad[0] |= INPUT_B;
|
if(mouse_b & 2) input.pad[0] |= INPUT_B;
|
||||||
if(mouse_b & 1) input.pad[0] |= INPUT_A;
|
if(mouse_b & 1) input.pad[0] |= INPUT_A;
|
||||||
if(mouse_b & 4) pico_current++;
|
if(mouse_b & 4) pico_current++;
|
||||||
if (pico_current > 6) pico_current = 0;
|
if (pico_current > 6) pico_current = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(check_key(KEY_F1)) frame_skip = 1;
|
||||||
|
if(check_key(KEY_F2)) frame_skip = 2;
|
||||||
|
if(check_key(KEY_F3)) frame_skip = 3;
|
||||||
|
if(check_key(KEY_F4)) frame_skip = 4;
|
||||||
|
|
||||||
if(check_key(KEY_F1)) frame_skip = 1;
|
if(check_key(KEY_F5)) log_error ^= 1;
|
||||||
if(check_key(KEY_F2)) frame_skip = 2;
|
if(check_key(KEY_F6)) debug_on ^= 1;
|
||||||
if(check_key(KEY_F3)) frame_skip = 3;
|
|
||||||
if(check_key(KEY_F4)) frame_skip = 4;
|
|
||||||
|
|
||||||
if(check_key(KEY_F5)) log_error ^= 1;
|
if(check_key(KEY_F7))
|
||||||
if(check_key(KEY_F6)) debug_on ^= 1;
|
{
|
||||||
|
f = fopen("game.gpz","r+b");
|
||||||
if(check_key(KEY_F7))
|
if (f)
|
||||||
{
|
{
|
||||||
f = fopen("game.gpz","r+b");
|
fread(&buf, 0x23000, 1, f);
|
||||||
if (f)
|
state_load(buf);
|
||||||
{
|
fclose(f);
|
||||||
fread(&buf, 0x23000, 1, f);
|
}
|
||||||
state_load(buf);
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(check_key(KEY_F8))
|
|
||||||
{
|
|
||||||
f = fopen("game.gpz","w+b");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
state_save(buf);
|
|
||||||
fwrite(&buf, 0x23000, 1, f);
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(check_key(KEY_F9))
|
if(check_key(KEY_F8))
|
||||||
|
{
|
||||||
|
f = fopen("game.gpz","w+b");
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
|
state_save(buf);
|
||||||
|
fwrite(&buf, 0x23000, 1, f);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(check_key(KEY_F9))
|
||||||
{
|
{
|
||||||
vdp_pal ^= 1;
|
vdp_pal ^= 1;
|
||||||
|
|
||||||
/* reinitialize timings */
|
/* reinitialize timings */
|
||||||
system_init ();
|
system_init ();
|
||||||
audio_init(option.sndrate);
|
audio_init(option.sndrate);
|
||||||
fm_restore();
|
fm_restore();
|
||||||
|
|
||||||
/* reinitialize HVC tables */
|
/* reinitialize HVC tables */
|
||||||
@ -382,268 +381,267 @@ void dos_update_input(void)
|
|||||||
bitmap.viewport.changed = 1;
|
bitmap.viewport.changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(check_key(KEY_F10)) set_softreset();
|
if(check_key(KEY_F10)) set_softreset();
|
||||||
if(check_key(KEY_TAB)) system_reset();
|
if(check_key(KEY_TAB)) system_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dos_update_audio(void)
|
void dos_update_audio(void)
|
||||||
{
|
{
|
||||||
osd_play_streamed_sample_16(option.swap ^ 0, snd.buffer[0], snd.buffer_size * 2, option.sndrate, FRAMES_PER_SECOND, -100);
|
osd_play_streamed_sample_16(option.swap ^ 0, snd.buffer[0], snd.buffer_size * 2, option.sndrate, FRAMES_PER_SECOND, -100);
|
||||||
osd_play_streamed_sample_16(option.swap ^ 1, snd.buffer[1], snd.buffer_size * 2, option.sndrate, FRAMES_PER_SECOND, 100);
|
osd_play_streamed_sample_16(option.swap ^ 1, snd.buffer[1], snd.buffer_size * 2, option.sndrate, FRAMES_PER_SECOND, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void dos_update_palette(void)
|
void dos_update_palette(void)
|
||||||
{
|
{
|
||||||
if(is_border_dirty)
|
if(is_border_dirty)
|
||||||
|
{
|
||||||
|
uint16 data = *(uint16 *)&cram[(border << 1)];
|
||||||
|
RGB *color;
|
||||||
|
|
||||||
|
is_border_dirty = 0;
|
||||||
|
|
||||||
|
if(reg[12] & 8)
|
||||||
{
|
{
|
||||||
uint16 data = *(uint16 *)&cram[(border << 1)];
|
int j;
|
||||||
|
for(j = 0; j < 3; j += 1)
|
||||||
|
{
|
||||||
|
color = &vdp_palette[j][data];
|
||||||
|
set_color((j << 6), color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color = &vdp_palette[1][data];
|
||||||
|
set_color(0x00, color);
|
||||||
|
set_color(0x40, color);
|
||||||
|
set_color(0x80, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_color_dirty)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
uint16 *p = (uint16 *)&cram[0];
|
||||||
|
is_color_dirty = 0;
|
||||||
|
|
||||||
|
for(i = 0; i < 64; i += 1)
|
||||||
|
{
|
||||||
|
if((color_dirty[i]) && ((i & 0x0F) != 0x00))
|
||||||
|
{
|
||||||
RGB *color;
|
RGB *color;
|
||||||
|
color_dirty[i] = 0;
|
||||||
is_border_dirty = 0;
|
|
||||||
|
|
||||||
if(reg[12] & 8)
|
if(reg[12] & 8)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
for(j = 0; j < 3; j += 1)
|
for(j = 0; j < 3; j += 1)
|
||||||
{
|
{
|
||||||
color = &vdp_palette[j][data];
|
color = &vdp_palette[j][p[i]];
|
||||||
set_color((j << 6), color);
|
set_color((j << 6) | i, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color = &vdp_palette[1][data];
|
color = &vdp_palette[1][p[i]];
|
||||||
set_color(0x00, color);
|
set_color(0x00 | i, color);
|
||||||
set_color(0x40, color);
|
set_color(0x40 | i, color);
|
||||||
set_color(0x80, color);
|
set_color(0x80 | i, color);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(is_color_dirty)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
uint16 *p = (uint16 *)&cram[0];
|
|
||||||
is_color_dirty = 0;
|
|
||||||
|
|
||||||
for(i = 0; i < 64; i += 1)
|
|
||||||
{
|
|
||||||
if((color_dirty[i]) && ((i & 0x0F) != 0x00))
|
|
||||||
{
|
|
||||||
RGB *color;
|
|
||||||
color_dirty[i] = 0;
|
|
||||||
if(reg[12] & 8)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for(j = 0; j < 3; j += 1)
|
|
||||||
{
|
|
||||||
color = &vdp_palette[j][p[i]];
|
|
||||||
set_color((j << 6) | i, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
color = &vdp_palette[1][p[i]];
|
|
||||||
set_color(0x00 | i, color);
|
|
||||||
set_color(0x40 | i, color);
|
|
||||||
set_color(0x80 | i, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void dos_update_video(void)
|
void dos_update_video(void)
|
||||||
{
|
{
|
||||||
int width = (bitmap.viewport.w + 2 * bitmap.viewport.x);
|
int width = (bitmap.viewport.w + 2 * bitmap.viewport.x);
|
||||||
int height = (bitmap.viewport.h + 2 * bitmap.viewport.y) << (interlaced ? 1:0);
|
int height = (bitmap.viewport.h + 2 * bitmap.viewport.y) << (interlaced ? 1:0);
|
||||||
int center_x = (SCREEN_W - width) / 2;
|
int center_x = (SCREEN_W - width) / 2;
|
||||||
int center_y = (SCREEN_H / (option.scanlines ? 4 : 2)) - (height / 2);
|
int center_y = (SCREEN_H / (option.scanlines ? 4 : 2)) - (height / 2);
|
||||||
|
|
||||||
/* Wait for VSync */
|
/* Wait for VSync */
|
||||||
if(option.vsync) vsync();
|
if(option.vsync) vsync();
|
||||||
|
|
||||||
if(bitmap.viewport.changed)
|
if(bitmap.viewport.changed)
|
||||||
|
{
|
||||||
|
bitmap.viewport.changed = 0;
|
||||||
|
if(bitmap.remap)
|
||||||
{
|
{
|
||||||
bitmap.viewport.changed = 0;
|
clear(screen);
|
||||||
if(bitmap.remap)
|
|
||||||
{
|
|
||||||
clear(screen);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clear_to_color(screen, 0xFF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if(bitmap.remap == 0)
|
|
||||||
{
|
|
||||||
dos_update_palette();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
msg_print(2, 2, "offset = 0x%x", hc_latch/*frame_rate*/);
|
|
||||||
|
|
||||||
if(option.scanlines)
|
|
||||||
{
|
|
||||||
int y;
|
|
||||||
for(y = 0; y < height; y += 1)
|
|
||||||
{
|
|
||||||
blit(gen_bmp, screen, 0x0, y, center_x, (center_y + y) << 1, width, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stretch_blit(gen_bmp, screen, 0, 0, width, height, (SCREEN_W-352)/2, (SCREEN_H-240)/2, 352,240 << (interlaced ? 1:0));
|
clear_to_color(screen, 0xFF);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if(bitmap.remap == 0)
|
||||||
|
{
|
||||||
|
dos_update_palette();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
msg_print(2, 2, "%d", frame_rate);
|
||||||
|
|
||||||
|
if(option.scanlines)
|
||||||
|
{
|
||||||
|
int y;
|
||||||
|
for(y = 0; y < height; y += 1)
|
||||||
|
{
|
||||||
|
blit(gen_bmp, screen, 0x0, y, center_x, (center_y + y) << 1, width, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stretch_blit(gen_bmp, screen, 0, 0, width, height, (SCREEN_W-352)/2, (SCREEN_H-240)/2, 352,240 << (interlaced ? 1:0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_machine(void)
|
void init_machine(void)
|
||||||
{
|
{
|
||||||
do_config("gen.cfg");
|
do_config("gen.cfg");
|
||||||
|
|
||||||
if(option.sound)
|
if(option.sound)
|
||||||
{
|
{
|
||||||
msdos_init_sound(&option.sndrate, option.sndcard);
|
msdos_init_sound(&option.sndrate, option.sndcard);
|
||||||
}
|
}
|
||||||
|
|
||||||
allegro_init();
|
allegro_init();
|
||||||
install_mouse();
|
install_mouse();
|
||||||
install_keyboard();
|
install_keyboard();
|
||||||
install_joystick(option.joy_driver);
|
install_joystick(option.joy_driver);
|
||||||
|
|
||||||
install_timer();
|
install_timer();
|
||||||
LOCK_FUNCTION(tick_handler);
|
LOCK_FUNCTION(tick_handler);
|
||||||
LOCK_VARIABLE(tick_count);
|
LOCK_VARIABLE(tick_count);
|
||||||
LOCK_VARIABLE(frame_rate);
|
LOCK_VARIABLE(frame_rate);
|
||||||
install_int_ex(tick_handler, BPS_TO_TIMER(FRAMES_PER_SECOND));
|
install_int_ex(tick_handler, BPS_TO_TIMER(FRAMES_PER_SECOND));
|
||||||
|
|
||||||
set_color_depth(option.video_depth);
|
set_color_depth(option.video_depth);
|
||||||
gen_bmp = create_bitmap(360, 576);
|
gen_bmp = create_bitmap(720, 576);
|
||||||
clear(gen_bmp);
|
clear(gen_bmp);
|
||||||
|
|
||||||
memset(&bitmap, 0, sizeof(bitmap));
|
memset(&bitmap, 0, sizeof(bitmap));
|
||||||
bitmap.data = (uint8 *)&gen_bmp->line[0][0];
|
bitmap.data = (uint8 *)&gen_bmp->line[0][0];
|
||||||
bitmap.width = gen_bmp->w;
|
bitmap.width = gen_bmp->w;
|
||||||
bitmap.height = gen_bmp->h;
|
bitmap.height = gen_bmp->h;
|
||||||
bitmap.depth = option.video_depth;
|
bitmap.depth = option.video_depth;
|
||||||
switch(option.video_depth)
|
switch(option.video_depth)
|
||||||
{
|
{
|
||||||
case 8:
|
case 8:
|
||||||
bitmap.granularity = 1;
|
bitmap.granularity = 1;
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
bitmap.granularity = 2;
|
bitmap.granularity = 2;
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
bitmap.granularity = 2;
|
bitmap.granularity = 2;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
bitmap.granularity = 4;
|
bitmap.granularity = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bitmap.pitch = (bitmap.width * bitmap.granularity);
|
bitmap.pitch = (bitmap.width * bitmap.granularity);
|
||||||
bitmap.viewport.w = 256;
|
bitmap.viewport.w = 256;
|
||||||
bitmap.viewport.h = 224;
|
bitmap.viewport.h = 224;
|
||||||
bitmap.viewport.x = 0x00;
|
bitmap.viewport.x = 0x00;
|
||||||
bitmap.viewport.y = 0x00;
|
bitmap.viewport.y = 0x00;
|
||||||
bitmap.remap = 0;
|
bitmap.remap = 0;
|
||||||
if(option.remap) bitmap.remap = 1;
|
if(option.remap) bitmap.remap = 1;
|
||||||
else
|
else
|
||||||
if(bitmap.depth > 8) bitmap.remap = 1;
|
if(bitmap.depth > 8) bitmap.remap = 1;
|
||||||
|
|
||||||
make_vdp_palette();
|
make_vdp_palette();
|
||||||
|
|
||||||
memcpy(gen_pal, black_palette, sizeof(PALETTE));
|
memcpy(gen_pal, black_palette, sizeof(PALETTE));
|
||||||
gen_pal[0xFE].r = \
|
gen_pal[0xFE].r = \
|
||||||
gen_pal[0xFE].g = \
|
gen_pal[0xFE].g = \
|
||||||
gen_pal[0xFE].b = 0x3F;
|
gen_pal[0xFE].b = 0x3F;
|
||||||
|
|
||||||
dos_change_mode();
|
dos_change_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void trash_machine(void)
|
void trash_machine(void)
|
||||||
{
|
{
|
||||||
if(option.sound)
|
if(option.sound)
|
||||||
{
|
{
|
||||||
msdos_shutdown_sound();
|
msdos_shutdown_sound();
|
||||||
}
|
}
|
||||||
clear(screen);
|
clear(screen);
|
||||||
destroy_bitmap(gen_bmp);
|
destroy_bitmap(gen_bmp);
|
||||||
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void make_vdp_palette(void)
|
void make_vdp_palette(void)
|
||||||
{
|
{
|
||||||
uint8 lut[3][8] =
|
uint8 lut[3][8] =
|
||||||
{
|
{
|
||||||
{0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C},
|
{0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C},
|
||||||
{0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38},
|
{0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38},
|
||||||
{0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C},
|
{0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C},
|
||||||
};
|
};
|
||||||
|
|
||||||
int j;
|
int j;
|
||||||
for(j = 0; j < 0x600; j += 1)
|
for(j = 0; j < 0x600; j += 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
int r = (j >> 6) & 7;
|
int r = (j >> 6) & 7;
|
||||||
int g = (j >> 3) & 7;
|
int g = (j >> 3) & 7;
|
||||||
int b = (j >> 0) & 7;
|
int b = (j >> 0) & 7;
|
||||||
int i = (j >> 9) & 3;
|
int i = (j >> 9) & 3;
|
||||||
|
|
||||||
vdp_palette[i][j & 0x1FF].r = lut[i][r];
|
vdp_palette[i][j & 0x1FF].r = lut[i][r];
|
||||||
vdp_palette[i][j & 0x1FF].g = lut[i][g];
|
vdp_palette[i][j & 0x1FF].g = lut[i][g];
|
||||||
vdp_palette[i][j & 0x1FF].b = lut[i][b];
|
vdp_palette[i][j & 0x1FF].b = lut[i][b];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dos_change_mode(void)
|
void dos_change_mode(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int width = option.video_width;
|
int width = option.video_width;
|
||||||
int height = option.video_height;
|
int height = option.video_height;
|
||||||
|
|
||||||
if(option.scanlines) height *= 2;
|
if(option.scanlines) height *= 2;
|
||||||
ret = set_gfx_mode(option.video_driver, width, height, 0, 0);
|
ret = set_gfx_mode(option.video_driver, width, height, 0, 0);
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
{
|
{
|
||||||
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
|
||||||
printf("Error setting graphics mode (%dx%d %dbpp).\nAllegro says: `%s'\n", width, height, option.video_depth, allegro_error);
|
printf("Error setting graphics mode (%dx%d %dbpp).\nAllegro says: `%s'\n", width, height, option.video_depth, allegro_error);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bitmap.depth == 8)
|
if(bitmap.depth == 8)
|
||||||
|
{
|
||||||
|
if(bitmap.remap)
|
||||||
{
|
{
|
||||||
if(bitmap.remap)
|
int i;
|
||||||
{
|
for(i = 0; i < 0x100; i += 1)
|
||||||
int i;
|
{
|
||||||
for(i = 0; i < 0x100; i += 1)
|
gen_pal[i].r = ((i >> 5) & 7) << 3;
|
||||||
{
|
gen_pal[i].g = ((i >> 2) & 7) << 3;
|
||||||
gen_pal[i].r = ((i >> 5) & 7) << 3;
|
gen_pal[i].b = ((i >> 0) & 3) << 4;
|
||||||
gen_pal[i].g = ((i >> 2) & 7) << 3;
|
}
|
||||||
gen_pal[i].b = ((i >> 0) & 3) << 4;
|
set_palette(gen_pal);
|
||||||
}
|
|
||||||
set_palette(gen_pal);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clear_to_color(screen, 0xFF);
|
|
||||||
gen_pal[0xfe].r = 0xff;
|
|
||||||
gen_pal[0xfe].g = 0xff;
|
|
||||||
gen_pal[0xfe].b = 0xff;
|
|
||||||
set_palette(gen_pal);
|
|
||||||
inp(0x3DA);
|
|
||||||
outp(0x3C0, 0x31);
|
|
||||||
outp(0x3C0, 0xFF);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clear(screen);
|
clear_to_color(screen, 0xFF);
|
||||||
|
gen_pal[0xfe].r = 0xff;
|
||||||
|
gen_pal[0xfe].g = 0xff;
|
||||||
|
gen_pal[0xfe].b = 0xff;
|
||||||
|
set_palette(gen_pal);
|
||||||
|
inp(0x3DA);
|
||||||
|
outp(0x3C0, 0x31);
|
||||||
|
outp(0x3C0, 0xFF);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clear(screen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -651,17 +649,17 @@ void dos_change_mode(void)
|
|||||||
/* Check if a key is pressed */
|
/* Check if a key is pressed */
|
||||||
int check_key(int code)
|
int check_key(int code)
|
||||||
{
|
{
|
||||||
static char lastbuf[0x100] = {0};
|
static char lastbuf[0x100] = {0};
|
||||||
|
|
||||||
if((!key[code]) && (lastbuf[code] == 1))
|
if((!key[code]) && (lastbuf[code] == 1))
|
||||||
lastbuf[code] = 0;
|
lastbuf[code] = 0;
|
||||||
|
|
||||||
if((key[code]) && (lastbuf[code] == 0))
|
if((key[code]) && (lastbuf[code] == 0))
|
||||||
{
|
{
|
||||||
lastbuf[code] = 1;
|
lastbuf[code] = 1;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ void make_vdp_palette(void);
|
|||||||
void dos_change_mode(void);
|
void dos_change_mode(void);
|
||||||
int check_key(int code);
|
int check_key(int code);
|
||||||
|
|
||||||
#define update_input() dos_update_input()
|
|
||||||
#define MAX_INPUTS 8
|
#define MAX_INPUTS 8
|
||||||
|
|
||||||
extern uint8 debug_on;
|
extern uint8 debug_on;
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
FILE *error_log;
|
FILE *error_log;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int enabled;
|
int enabled;
|
||||||
int verbose;
|
int verbose;
|
||||||
FILE *log;
|
FILE *log;
|
||||||
} t_error;
|
} t_error;
|
||||||
|
|
||||||
void error_init(void)
|
void error_init(void)
|
||||||
@ -23,8 +23,8 @@ void error_shutdown(void)
|
|||||||
|
|
||||||
void error(char *format, ...)
|
void error(char *format, ...)
|
||||||
{
|
{
|
||||||
if (!log_error) return;
|
if (!log_error) return;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
if(error_log) vfprintf(error_log, format, ap);
|
if(error_log) vfprintf(error_log, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
1294
source/unused/dos/unzip.c
Normal file
1294
source/unused/dos/unzip.c
Normal file
File diff suppressed because it is too large
Load Diff
273
source/unused/dos/unzip.h
Normal file
273
source/unused/dos/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 */
|
@ -31,7 +31,6 @@ OBJECTS += obj/genesis.o \
|
|||||||
obj/mem68k.o \
|
obj/mem68k.o \
|
||||||
obj/memz80.o \
|
obj/memz80.o \
|
||||||
obj/membnk.o \
|
obj/membnk.o \
|
||||||
obj/memvdp.o \
|
|
||||||
obj/state.o
|
obj/state.o
|
||||||
|
|
||||||
OBJECTS += obj/sound.o \
|
OBJECTS += obj/sound.o \
|
||||||
|
@ -11,8 +11,8 @@ void set_config_defaults(void)
|
|||||||
config.fm_preamp = 1.0;
|
config.fm_preamp = 1.0;
|
||||||
config.boost = 1;
|
config.boost = 1;
|
||||||
config.filter = 1;
|
config.filter = 1;
|
||||||
config.hq_fm = 2;
|
config.hq_fm = 1;
|
||||||
config.fm_core = 0;
|
config.fm_core = 1;
|
||||||
|
|
||||||
/* system options */
|
/* system options */
|
||||||
config.region_detect = 0;
|
config.region_detect = 0;
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
FILE *error_log;
|
FILE *error_log;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int enabled;
|
int enabled;
|
||||||
int verbose;
|
int verbose;
|
||||||
FILE *log;
|
FILE *log;
|
||||||
} t_error;
|
} t_error;
|
||||||
|
|
||||||
void error_init(void)
|
void error_init(void)
|
||||||
{
|
{
|
||||||
#ifdef LOG_ERROR
|
#ifdef LOGERROR
|
||||||
error_log = fopen("error.log","w");
|
error_log = fopen("error.log","w");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -27,8 +27,8 @@ void error_shutdown(void)
|
|||||||
|
|
||||||
void error(char *format, ...)
|
void error(char *format, ...)
|
||||||
{
|
{
|
||||||
if (!log_error) return;
|
if (!log_error) return;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
if(error_log) vfprintf(error_log, format, ap);
|
if(error_log) vfprintf(error_log, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
@ -24,9 +24,9 @@ int playbuffer = 0;
|
|||||||
|
|
||||||
uint8 log_error = 0;
|
uint8 log_error = 0;
|
||||||
uint8 debug_on = 0;
|
uint8 debug_on = 0;
|
||||||
uint8 turbo_mode = 0;
|
uint8 turbo_mode = 1;
|
||||||
uint8 use_sound = 1;
|
uint8 use_sound = 0;
|
||||||
uint8 fullscreen = 0;
|
uint8 fullscreen = 0;
|
||||||
|
|
||||||
int audio_len;
|
int audio_len;
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ static int sdl_sound_init()
|
|||||||
if(SDL_Init(SDL_INIT_AUDIO) < 0)
|
if(SDL_Init(SDL_INIT_AUDIO) < 0)
|
||||||
{
|
{
|
||||||
char caption[256];
|
char caption[256];
|
||||||
sprintf(caption, "SDL audio can't initialize");
|
sprintf(caption, "SDL audio can't initialize");
|
||||||
MessageBox(NULL, caption, "Error", 0);
|
MessageBox(NULL, caption, "Error", 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,12 +67,12 @@ static int sdl_sound_init()
|
|||||||
if(SDL_OpenAudio(&audio, NULL) == -1)
|
if(SDL_OpenAudio(&audio, NULL) == -1)
|
||||||
{
|
{
|
||||||
char caption[256];
|
char caption[256];
|
||||||
sprintf(caption, "SDL can't open audio");
|
sprintf(caption, "SDL can't open audio");
|
||||||
MessageBox(NULL, caption, "Error", 0);
|
MessageBox(NULL, caption, "Error", 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(soundbuffer, 0, 16 * 3840);
|
memset(soundbuffer, 0, 16 * 3840);
|
||||||
mixbuffer = 0;
|
mixbuffer = 0;
|
||||||
playbuffer = 0;
|
playbuffer = 0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -86,32 +86,32 @@ static long output_pitch;
|
|||||||
|
|
||||||
Uint32 fps_callback(Uint32 interval)
|
Uint32 fps_callback(Uint32 interval)
|
||||||
{
|
{
|
||||||
if(paused) return 1000/vdp_rate;
|
if(paused) return 1000/vdp_rate;
|
||||||
timer_count++;
|
timer_count++;
|
||||||
frameticker ++;
|
frameticker ++;
|
||||||
if(timer_count % vdp_rate == 0)
|
if(timer_count % vdp_rate == 0)
|
||||||
{
|
{
|
||||||
int fps = frame_count + 1;
|
int fps = frame_count + 1;
|
||||||
char caption[100];
|
char caption[100];
|
||||||
char region[10];
|
char region[10];
|
||||||
if (region_code == REGION_USA) sprintf(region,"USA");
|
if (region_code == REGION_USA) sprintf(region,"USA");
|
||||||
else if (region_code == REGION_EUROPE) sprintf(region,"EUR");
|
else if (region_code == REGION_EUROPE) sprintf(region,"EUR");
|
||||||
else sprintf(region,"JAP");
|
else sprintf(region,"JAP");
|
||||||
sprintf(caption, "Genesis Plus/SDL - %s (%s) - %d fps", rominfo.international, region, fps);
|
sprintf(caption, "Genesis Plus/SDL - %s (%s) - %d fps", rominfo.international, region, fps);
|
||||||
SDL_WM_SetCaption(caption, NULL);
|
SDL_WM_SetCaption(caption, NULL);
|
||||||
frame_count = 0;
|
frame_count = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1000/vdp_rate;
|
return 1000/vdp_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lock_pixels( void )
|
void lock_pixels( void )
|
||||||
{
|
{
|
||||||
if ( SDL_LockSurface( surface ) < 0 )
|
if ( SDL_LockSurface( surface ) < 0 )
|
||||||
MessageBox(NULL, "Couldn't lock surface", "Error", 0);
|
MessageBox(NULL, "Couldn't lock surface", "Error", 0);
|
||||||
SDL_FillRect( surface, 0, 0 );
|
SDL_FillRect( surface, 0, 0 );
|
||||||
output_pitch = surface->pitch;
|
output_pitch = surface->pitch;
|
||||||
output_pixels = (unsigned char*) surface->pixels;
|
output_pixels = (unsigned char*) surface->pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_output( void )
|
void display_output( void )
|
||||||
@ -121,9 +121,9 @@ void display_output( void )
|
|||||||
dest.h=rect.h;
|
dest.h=rect.h;
|
||||||
dest.x=(640-rect.w)/2;
|
dest.x=(640-rect.w)/2;
|
||||||
dest.y=(480-rect.h)/2;
|
dest.y=(480-rect.h)/2;
|
||||||
//SDL_UnlockSurface( surface );
|
//SDL_UnlockSurface( surface );
|
||||||
if ( SDL_BlitSurface( surface, &rect, screen, &dest ) < 0 || SDL_Flip( screen ) < 0 )
|
if ( SDL_BlitSurface( surface, &rect, screen, &dest ) < 0 || SDL_Flip( screen ) < 0 )
|
||||||
MessageBox(NULL, "SDL blit failed", "Error", 0);
|
MessageBox(NULL, "SDL blit failed", "Error", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
md_ntsc_t md_ntsc;
|
md_ntsc_t md_ntsc;
|
||||||
@ -131,7 +131,7 @@ sms_ntsc_t sms_ntsc;
|
|||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int running = 1;
|
int running = 1;
|
||||||
int sym;
|
int sym;
|
||||||
md_ntsc_setup_t md_setup;
|
md_ntsc_setup_t md_setup;
|
||||||
sms_ntsc_setup_t sms_setup;
|
sms_ntsc_setup_t sms_setup;
|
||||||
@ -141,42 +141,42 @@ int main (int argc, char **argv)
|
|||||||
error_init();
|
error_init();
|
||||||
|
|
||||||
/* Print help if no game specified */
|
/* Print help if no game specified */
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
{
|
{
|
||||||
char caption[256];
|
char caption[256];
|
||||||
sprintf(caption, "Genesis Plus\\SDL by Charles MacDonald\nWWW: http://cgfm2.emuviews.com\nusage: %s gamename\n", argv[0]);
|
sprintf(caption, "Genesis Plus\\SDL by Charles MacDonald\nWWW: http://cgfm2.emuviews.com\nusage: %s gamename\n", argv[0]);
|
||||||
MessageBox(NULL, caption, "Information", 0);
|
MessageBox(NULL, caption, "Information", 0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load game */
|
/* Load game */
|
||||||
cart_rom = malloc(0xA00000);
|
cart_rom = malloc(0xA00000);
|
||||||
memset(cart_rom, 0, 0xA00000);
|
memset(cart_rom, 0, 0xA00000);
|
||||||
if(!load_rom(argv[1]))
|
if(!load_rom(argv[1]))
|
||||||
{
|
{
|
||||||
char caption[256];
|
char caption[256];
|
||||||
sprintf(caption, "Error loading file `%s'.", argv[1]);
|
sprintf(caption, "Error loading file `%s'.", argv[1]);
|
||||||
MessageBox(NULL, caption, "Error", 0);
|
MessageBox(NULL, caption, "Error", 0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize SDL */
|
/* initialize SDL */
|
||||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
|
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
|
||||||
{
|
{
|
||||||
char caption[256];
|
char caption[256];
|
||||||
sprintf(caption, "SDL initialization failed");
|
sprintf(caption, "SDL initialization failed");
|
||||||
MessageBox(NULL, caption, "Error", 0);
|
MessageBox(NULL, caption, "Error", 0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
SDL_WM_SetCaption("Genesis Plus/SDL", NULL);
|
SDL_WM_SetCaption("Genesis Plus/SDL", NULL);
|
||||||
SDL_ShowCursor(0);
|
SDL_ShowCursor(0);
|
||||||
|
|
||||||
screen = SDL_SetVideoMode(640, 480, 16, fullscreen ? (SDL_SWSURFACE|SDL_FULLSCREEN): (SDL_SWSURFACE));
|
screen = SDL_SetVideoMode(640, 480, 16, fullscreen ? (SDL_HWSURFACE|SDL_FULLSCREEN): (SDL_HWSURFACE));
|
||||||
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 720, 576, 16, 0, 0, 0, 0);
|
surface = SDL_CreateRGBSurface(SDL_HWSURFACE, 720, 576, 16, 0, 0, 0, 0);
|
||||||
if (!screen || !surface)
|
if (!screen || !surface)
|
||||||
{
|
{
|
||||||
MessageBox(NULL, "Video initialization failed", "Error", 0);
|
MessageBox(NULL, "Video initialization failed", "Error", 0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize Genesis display */
|
/* initialize Genesis display */
|
||||||
@ -197,24 +197,24 @@ int main (int argc, char **argv)
|
|||||||
input.system[0] = SYSTEM_GAMEPAD;
|
input.system[0] = SYSTEM_GAMEPAD;
|
||||||
input.system[1] = SYSTEM_GAMEPAD;
|
input.system[1] = SYSTEM_GAMEPAD;
|
||||||
|
|
||||||
/* load BIOS */
|
/* load BIOS */
|
||||||
memset(bios_rom, 0, sizeof(bios_rom));
|
memset(bios_rom, 0, sizeof(bios_rom));
|
||||||
FILE *f = fopen("./BIOS.bin", "rb");
|
FILE *f = fopen("./BIOS.bin", "rb");
|
||||||
if (f!=NULL)
|
if (f!=NULL)
|
||||||
{
|
{
|
||||||
fread(&bios_rom, 0x800,1,f);
|
fread(&bios_rom, 0x800,1,f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < 0x800; i += 2)
|
for(i = 0; i < 0x800; i += 2)
|
||||||
{
|
{
|
||||||
uint8 temp = bios_rom[i];
|
uint8 temp = bios_rom[i];
|
||||||
bios_rom[i] = bios_rom[i+1];
|
bios_rom[i] = bios_rom[i+1];
|
||||||
bios_rom[i+1] = temp;
|
bios_rom[i+1] = temp;
|
||||||
}
|
}
|
||||||
config.bios_enabled |= 2;
|
config.bios_enabled |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize emulation */
|
/* initialize emulation */
|
||||||
system_init();
|
system_init();
|
||||||
audio_init(SOUND_FREQUENCY);
|
audio_init(SOUND_FREQUENCY);
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ int main (int argc, char **argv)
|
|||||||
if (f!=NULL)
|
if (f!=NULL)
|
||||||
{
|
{
|
||||||
fread(sram.sram,0x10000,1, f);
|
fread(sram.sram,0x10000,1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset emulation */
|
/* reset emulation */
|
||||||
@ -236,23 +236,23 @@ int main (int argc, char **argv)
|
|||||||
SDL_SetTimer(1000/vdp_rate, fps_callback);
|
SDL_SetTimer(1000/vdp_rate, fps_callback);
|
||||||
if (use_sound) SDL_PauseAudio(0);
|
if (use_sound) SDL_PauseAudio(0);
|
||||||
|
|
||||||
while(running)
|
while(running)
|
||||||
{
|
{
|
||||||
while (SDL_PollEvent(&event))
|
while (SDL_PollEvent(&event))
|
||||||
{
|
{
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case SDL_QUIT: /* Windows was closed */
|
case SDL_QUIT: /* Windows was closed */
|
||||||
running = 0;
|
running = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_ACTIVEEVENT: /* Window focus changed or was minimized */
|
case SDL_ACTIVEEVENT: /* Window focus changed or was minimized */
|
||||||
if(event.active.state & (SDL_APPINPUTFOCUS | SDL_APPACTIVE))
|
if(event.active.state & (SDL_APPINPUTFOCUS | SDL_APPACTIVE))
|
||||||
{
|
{
|
||||||
paused = !event.active.gain;
|
paused = !event.active.gain;
|
||||||
if (use_sound) SDL_PauseAudio(paused);
|
if (use_sound) SDL_PauseAudio(paused);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_KEYDOWN: /* user options */
|
case SDL_KEYDOWN: /* user options */
|
||||||
sym = event.key.keysym.sym;
|
sym = event.key.keysym.sym;
|
||||||
@ -261,7 +261,7 @@ int main (int argc, char **argv)
|
|||||||
else if (sym == SDLK_RETURN)
|
else if (sym == SDLK_RETURN)
|
||||||
{
|
{
|
||||||
fullscreen ^=1;
|
fullscreen ^=1;
|
||||||
screen = SDL_SetVideoMode(640, 480, 16, fullscreen ? (SDL_SWSURFACE|SDL_FULLSCREEN): (SDL_SWSURFACE));
|
screen = SDL_SetVideoMode(640, 480, 16, fullscreen ? (SDL_HWSURFACE|SDL_FULLSCREEN): (SDL_HWSURFACE));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(sym == SDLK_F3) config.render ^=1;
|
else if(sym == SDLK_F3) config.render ^=1;
|
||||||
@ -337,10 +337,11 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!paused)
|
if(!paused)
|
||||||
{
|
{
|
||||||
@ -359,14 +360,15 @@ int main (int argc, char **argv)
|
|||||||
system_frame (0);
|
system_frame (0);
|
||||||
frame_count++;
|
frame_count++;
|
||||||
}
|
}
|
||||||
|
update_input();
|
||||||
|
|
||||||
frameticker--;
|
frameticker--;
|
||||||
|
|
||||||
if(bitmap.viewport.changed)
|
if(bitmap.viewport.changed)
|
||||||
{
|
{
|
||||||
bitmap.viewport.changed = 0;
|
bitmap.viewport.changed = 0;
|
||||||
rect.w = bitmap.viewport.w+2*bitmap.viewport.x;
|
rect.w = bitmap.viewport.w+2*bitmap.viewport.x;
|
||||||
rect.h = bitmap.viewport.h+2*bitmap.viewport.y;
|
rect.h = bitmap.viewport.h+2*bitmap.viewport.y;
|
||||||
if (config.render && (interlaced || config.ntsc)) rect.h *= 2;
|
if (config.render && (interlaced || config.ntsc)) rect.h *= 2;
|
||||||
if (config.ntsc) rect.w = (reg[12]&1) ? MD_NTSC_OUT_WIDTH(rect.w) : SMS_NTSC_OUT_WIDTH(rect.w);
|
if (config.ntsc) rect.w = (reg[12]&1) ? MD_NTSC_OUT_WIDTH(rect.w) : SMS_NTSC_OUT_WIDTH(rect.w);
|
||||||
|
|
||||||
@ -403,7 +405,7 @@ int main (int argc, char **argv)
|
|||||||
if (f!=NULL)
|
if (f!=NULL)
|
||||||
{
|
{
|
||||||
fwrite(&sram.sram,0x10000,1, f);
|
fwrite(&sram.sram,0x10000,1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_PauseAudio(1);
|
SDL_PauseAudio(1);
|
||||||
@ -424,8 +426,8 @@ int update_input(void)
|
|||||||
|
|
||||||
while (input.dev[joynum] == NO_DEVICE)
|
while (input.dev[joynum] == NO_DEVICE)
|
||||||
{
|
{
|
||||||
joynum ++;
|
joynum ++;
|
||||||
if (joynum > MAX_DEVICES - 1) joynum = 0;
|
if (joynum > MAX_DEVICES - 1) joynum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset input */
|
/* reset input */
|
||||||
@ -448,7 +450,6 @@ int update_input(void)
|
|||||||
if(keystate[SDLK_c]) input.pad[joynum] |= INPUT_Z;
|
if(keystate[SDLK_c]) input.pad[joynum] |= INPUT_Z;
|
||||||
if(keystate[SDLK_v]) input.pad[joynum] |= INPUT_MODE;
|
if(keystate[SDLK_v]) input.pad[joynum] |= INPUT_MODE;
|
||||||
|
|
||||||
extern uint8 pico_current;
|
|
||||||
if (input.dev[joynum] == DEVICE_LIGHTGUN)
|
if (input.dev[joynum] == DEVICE_LIGHTGUN)
|
||||||
{
|
{
|
||||||
/* get mouse (absolute values) */
|
/* get mouse (absolute values) */
|
||||||
|
1294
source/unused/win/unzip.c
Normal file
1294
source/unused/win/unzip.c
Normal file
File diff suppressed because it is too large
Load Diff
273
source/unused/win/unzip.h
Normal file
273
source/unused/win/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