Fix first run crashing on Xbox One. Added savestate support. Rewind … (#87)

* Fix first run crashing on Xbox One.
* Added savestate support.
* Rewind works.  Fixes issue #83 and possibly #49.
* Added Disc Control menu.  Supports Disks, Tapes and M3U files (issue #66).
* Added in support for 5200 Super Carts.
* Better support for 5200 controller.
* Added Paddle support.
* Converted Core Options menu to v2.
* Moved some core options into submenus.
* Added controller mappings for Ports 2-4.
* Added options for Dual Stick and Swap Ports.  Fixes issue #76.
* Joystick/Console now controlled more easily with device type Atari Keyboard.
* Added 4 Hi-Res Artifacting modes.  Restart does something now.
* When core option changed only reboot if necessary.  Removed several hardcoded controller binds.  Fixed issue #29.  Joypad input ignored when virtual keyboard active.
* SIO Acceleration now defaults to enabled.  Fix for Bounty Bob (5200 & lift fix A800).
* Added Atari 800 carts to autodetect DB.
* Added more Carts to DB.
* Fixed Drive Index not being reset on 'restart'.
* Changed Atari Joystick default mappings to something more reasonable.
This commit is contained in:
greenchili2
2023-07-31 17:35:21 -04:00
committed by GitHub
parent 86be15db82
commit 20d59afb3f
50 changed files with 8226 additions and 2132 deletions
+278 -99
View File
@@ -1,6 +1,10 @@
#define a5200 0
#define a5200_40 1
#define a5200_ee_16 2
#define a5200 0 // 4, 8, NS16, 32
#define a5200_40 1 // Bounty Bob
#define a5200_ee_16 2 // 2 16k eeproms
#define a5200_64 3 // supercarts
#define a5200_128 4
#define a5200_256 5
#define a5200_512 6
typedef struct {
int type;
@@ -9,114 +13,289 @@ typedef struct {
ULONG crc;
} a5200_rom;
a5200_rom a5200_game[]={
a5200_rom a5200_game[] = {
{ a5200,"5200menu.bin",8192,0x0de2db48},
{ a5200,"aep.bin",16384,0x35484751},
{ a5200,"decathln.bin",16384,0xf43e7cd0},
{ a5200,"asteroid.bin",8192,0x38480891},
{ a5200_ee_16,"astrchse.bin",16384,0x4019ecec},
{ a5200,"ballblze.bin",32768,0x94d97d14},
{ a5200_ee_16,"bzone.bin",16384,0xb3b8e314},
{ a5200,"beamrid.bin",16384,0x9bae58dc},
{ a5200,"berzerk.bin",16384,0xbe3cd348},
{ a5200,"blckbelt.bin",32768,0xed47b0d8},
{ a5200,"blaster.bin",16384,0xc8f9c094},
{ a5200,"blueprnt.bin",16384,0x0624e6e7},
{ a5200_40,"bbstrksb.bin",40960,0x7873c6dd},
{ a5200_ee_16,"buckrog.bin",16384,0x04807705},
{ a5200_ee_16,"centiped.bin",16384,0x536a70fe},
{ a5200,"choplift.bin",16384,0x9ad53bbc},
{ a5200_ee_16,"congo.bin",16384,0xf1f42bbd},
{ a5200_ee_16,"cntrmsre.bin",16384,0xfd541c80},
{ a5200,"pitfall2.bin",16384,0x4b910461},
{ a5200_ee_16,"defender.bin",16384,0xbd52623b},
{ a5200_ee_16,"digdug.bin",16384,0x6a687f9c},
{ a5200,"dredfctr.bin",8192,0x460def2d},
{ a5200,"finalleg.bin",16384,0xd3bd3221},
{ a5200,"A.E. (Proto)",16384,0x35484751},
{ a5200,"Activision Decathlon",16384,0xf43e7cd0},
{ a5200,"Asteroids (USA) (Proto)",8192,0x38480891},
{ a5200_ee_16,"Astro Chase",16384,0x4019ecec},
{ a5200,"Ballblazer",32768,0x94d97d14},
{ a5200,"Ballblazer", 8192, 0xDEF2A207 },
{ a5200_ee_16,"Battle Zone (Proto)",16384,0xb3b8e314},
{ a5200,"Beamrider",16384,0x9bae58dc},
{ a5200,"Berzerk",16384,0xbe3cd348},
{ a5200,"Blackbelt (Proto)",32768,0xed47b0d8},
{ a5200,"Blaster (USA) (Proto)",16384,0xc8f9c094},
{ a5200,"Blue Print",16384,0x0624e6e7},
{ a5200_40,"Bounty Bob Strikes Back",40960,0x7873c6dd},
{ a5200_ee_16,"Buck Rogers - Planet of Zoom",16384,0x04807705},
{ a5200_ee_16,"Centipede",16384,0x536a70fe},
{ a5200,"Choplifter!",16384,0x9ad53bbc},
{ a5200_ee_16,"Congo Bongo",16384,0xf1f42bbd},
{ a5200_ee_16,"Counter Measure",16384,0xfd541c80},
{ a5200,"Dave Crane's Pitfall II - Lost Caverns",16384,0x4b910461},
{ a5200_ee_16,"Defender",16384,0xbd52623b},
{ a5200_ee_16,"Dig Dug",16384,0x6a687f9c},
{ a5200,"Dreadnaught Factor, The",8192,0x460def2d},
{ a5200,"Final Legacy (Proto)",16384,0xd3bd3221},
{ a5200_ee_16,"friskyt.bin",16384,0x04b299a4},
{ a5200,"frogger.bin",8192,0xae7e3444},
{ a5200_ee_16,"frogger2.bin",16384,0x0af19345},
{ a5200,"galaxian.bin",8192,0x3ef4a23f},
{ a5200,"Frisky Tom (Mouse Speed Fix)",32768,0x04b299a4},
{ a5200,"Frogger",8192,0xae7e3444},
{ a5200_ee_16,"Frogger II - Threeedeep!",16384,0x0af19345},
{ a5200,"Galaxian",8192,0x3ef4a23f},
{ a5200,"gorf.bin",8192,0xe955db74},
{ a5200,"gremlins.bin",32768,0x063ec2c4},
{ a5200_ee_16,"gyruss.bin",16384,0xcfd4a7f9},
{ a5200,"hero.bin",16384,0x18a73af3},
{ a5200_ee_16,"jamesbnd.bin",16384,0xd9ae4518},
{ a5200_ee_16,"joust.bin",16384,0xbfd30c01},
{ a5200_ee_16,"jrpacman.bin",16384,0x59983c40},
{ a5200_ee_16,"jungleh.bin",16384,0x2c676662},
{ a5200,"krazysht.bin",8192,0xee702214},
{ a5200,"kaboom.bin",4096,0x420f5d0b},
{ a5200_ee_16,"kangaroo.bin",16384,0xecfa624f},
{ a5200,"keystone.bin",8192,0x8fe3bb2c},
{ a5200,"laststar.bin",16384,0x83517703},
{ a5200_ee_16,"loontoon.bin",16384,0x84df4925},
{ a5200,"mario.bin",32768,0x873742f1},
{ a5200,"meebzork.bin",32768,0x9fb13411},
{ a5200,"megamnia.bin",8192,0x240a1e1a},
{ a5200,"meteorit.bin",16384,0xab8e035b},
{ a5200,"Gremlins",32768,0x063ec2c4},
{ a5200_ee_16,"Gyruss",16384,0xcfd4a7f9},
{ a5200,"H.E.R.O",16384,0x18a73af3},
{ a5200_ee_16,"James Bond 007",16384,0xd9ae4518},
{ a5200_ee_16,"Joust",16384,0xbfd30c01},
{ a5200_ee_16,"J.R. Pac-Man (Proto)",16384,0x59983c40},
{ a5200_ee_16,"Jungle Hunt",16384,0x2c676662},
{ a5200,"K-Razy Shoot-Out",8192,0xee702214},
{ a5200,"Kaboom!",4096,0x420f5d0b},
{ a5200_ee_16,"Kangaroo",16384,0xecfa624f},
{ a5200,"Keystone Kapers",8192,0x8fe3bb2c},
{ a5200,"Last Starfighter, The",16384,0x83517703},
{ a5200_ee_16,"Loony Tunes Hotel (Proto)",16384,0x84df4925},
{ a5200,"Mario Bros.",32768,0x873742f1},
{ a5200,"Meebzork",32768,0x9fb13411},
{ a5200,"MegaMania",8192,0x240a1e1a},
{ a5200,"Meteorites",16384,0xab8e035b},
{ a5200_ee_16,"microgam.bin",16384,0x931a454a},
{ a5200,"milliped.bin",16384,0x969cfe1a},
{ a5200,"mine2049.bin",16384,0x7df1adfb},
{ a5200_ee_16,"minigolf.bin",16384,0xc597c087},
{ a5200,"missile.bin",8192,0x44d3ff6f},
{ a5200_ee_16,"montezum.bin",16384,0x2a640143},
{ a5200,"mpatrol.bin",16384,0xd0b2f285},
{ a5200,"mntnking.bin",8192,0x0f24243c},
{ a5200,"docastle.bin",8192,0xaa55f9be},
{ a5200_ee_16,"mspacman.bin",16384,0x752f5efd},
{ a5200_ee_16,"pacman.bin",16384,0x8873ef51},
{ a5200,"pengo.bin",32768,0xe4f8ba8c},
{ a5200,"pitfall.bin",8192,0xb2887833},
{ a5200_ee_16,"polepos.bin",16384,0xabc2d1e4},
{ a5200_ee_16,"popeye.bin",16384,0xa18a9a40},
{ a5200,"Microgammon (Proto)",32768,0x960ce5e2},
{ a5200,"Millipede (Proto).bin",16384,0x969cfe1a},
{ a5200,"Miner 2049er Starring Bounty Bob",16384,0x7df1adfb},
{ a5200_ee_16,"Miniature Golf (Proto)",16384,0xc597c087},
{ a5200,"Missile Command",8192,0x44d3ff6f},
{ a5200_ee_16,"Montezuma's Revenge featuring Panama Joe",16384,0x2a640143},
{ a5200,"Moon Patrol",16384,0xd0b2f285},
{ a5200,"Mountain King",8192,0x0f24243c},
{ a5200,"Mr. Do's Castle",8192,0xaa55f9be},
{ a5200_ee_16,"Ms. Pac-Man",16384,0x752f5efd},
{ a5200_ee_16,"Pac-man",16384,0x8873ef51},
{ a5200,"Pengo",32768,0xe4f8ba8c},
{ a5200,"Pitfall.bin",8192,0xb2887833},
{ a5200_ee_16,"Pole Position",16384,0xabc2d1e4},
{ a5200_ee_16,"Popeye",16384,0xa18a9a40},
{ a5200,"qbert.bin",8192,0x3fe4a401},
{ a5200_ee_16,"qix.bin",16384,0xaea6d2c2},
{ a5200,"questroo.bin",16384,0xb5f3402b},
{ a5200,"rsbsebll.bin",32768,0x44166592},
{ a5200_ee_16,"QIX",16384,0xaea6d2c2},
{ a5200,"Quest For Quintana Roo",16384,0xb5f3402b},
{ a5200,"Realsports Baseball",32768,0x44166592},
{ a5200,"rsbktbll.bin",32768,0xdd217276},
{ a5200,"rsbktbll1.bin",32768,0xc90196fa},
{ a5200,"Realsports Basketball (Proto1)",32768,0xc90196fa},
{ a5200_ee_16,"rsbktbll2.bin",16384,0x0f996184},
{ a5200_ee_16,"rsftball.bin",16384,0x4336c2cc},
{ a5200_ee_16,"rssoccer.bin",16384,0xecbd1853},
{ a5200_ee_16,"rstennis.bin",16384,0x10f33c90},
{ a5200,"fractal.bin",32768,0x762c591b},
{ a5200,"riveraid.bin",8192,0x09fc7648},
{ a5200_ee_16,"roadrun.bin",16384,0xa97606ab},
{ a5200,"robotron.bin",16384,0x4252abd9},
{ a5200_ee_16,"spcedngn.bin",16384,0xb68d61e8},
{ a5200,"spaceinv.bin",8192,0xde5c354a},
{ a5200,"spceshut.bin",16384,0x387365dc},
{ a5200,"spitfire.bin",32768,0x3c311303},
{ a5200_ee_16,"sprtgoof.bin",16384,0x73b5b6fb},
{ a5200_ee_16,"starraid.bin",16384,0x7d819a9f},
{ a5200_ee_16,"startrek.bin",16384,0x69f23548},
{ a5200,"starwars.bin",8192,0x0675f0a5},
{ a5200_ee_16,"swa.bin",16384,0x75f566df},
{ a5200_ee_16,"stargate.bin",16384,0x1d1cee27},
{ a5200,"sprbreak.bin",4096,0xa0642110},
{ a5200,"scobra.bin",8192,0x97debcd2},
{ a5200,"spacman.bin",16384,0x0a4ddb1e},
{ a5200,"tempest.bin",16384,0x1187342f},
{ a5200,"trackfld.bin",16384,0x0ba22ece},
{ a5200,"vanguard.bin",32768,0xcaaea0a4},
{ a5200,"wow.bin",16384,0xd6f7ddfd},
{ a5200_ee_16,"xariarna.bin",16384,0xb8faaec3},
{ a5200,"xevious.bin",32768,0x382634dc},
{ a5200,"yllowsub.bin",4096,0xf47bc091},
{ a5200,"zaxxon.bin",32768,0x741746d1},
{ a5200,"zenji.bin",8192,0xda228530},
{ a5200,"znerangr.bin",16384,0x2959d827},
{ a5200_ee_16,"Realsports Football",16384,0x4336c2cc},
{ a5200_ee_16,"Realsports Soccer",16384,0xecbd1853},
{ a5200_ee_16,"RealSports Tennis",16384,0x10f33c90},
{ a5200,"Rescue on Fractalus!",32768,0x762c591b},
{ a5200,"Carol Shaw's River Raid",8192,0x09fc7648},
{ a5200_ee_16,"Road Runner (Proto)",16384,0xa97606ab},
{ a5200,"Robotron 2084",16384,0x4252abd9},
{ a5200_ee_16,"Space Dungeon",16384,0xb68d61e8},
{ a5200,"Space Invaders",8192,0xde5c354a},
{ a5200,"Space Shuttle",16384,0x387365dc},
{ a5200,"Spitfire (Proto)",32768,0x3c311303},
{ a5200_ee_16,"Sport Goofy (Proto)",16384,0x73b5b6fb},
{ a5200_ee_16,"Star Raiders",16384,0x7d819a9f},
{ a5200_ee_16,"Star Trek - Strategic Operations Simulator",16384,0x69f23548},
{ a5200,"Star Wars - Death Star Battle",8192,0x0675f0a5},
{ a5200_ee_16,"Star Wars - The Arcade Game",16384,0x75f566df},
{ a5200_ee_16,"Stargate (Proto)",16384,0x1d1cee27},
{ a5200,"Super Breakout",4096,0xa0642110},
{ a5200,"Super Cobra",8192,0x97debcd2},
{ a5200,"Super Pac-Man (USA) (Proto)",16384,0x0a4ddb1e},
{ a5200,"Tempest (Proto)",16384,0x1187342f},
{ a5200,"Track And Field",16384,0x0ba22ece},
{ a5200,"Vanguard",32768,0xcaaea0a4},
{ a5200,"Wizard Of Wor",16384,0xd6f7ddfd},
{ a5200_ee_16,"Xari Arena (Proto)",16384,0xb8faaec3},
{ a5200_ee_16,"Xari Arena (9-20-83)",16384,0x29178296},
{ a5200,"Xevious",32768,0x382634dc},
{ a5200,"Yellow Submarine (Proto)",4096,0xf47bc091},
{ a5200,"Zaxxon",32768,0x741746d1},
{ a5200,"Zenji",8192,0xda228530},
{ a5200,"Zone Ranger",16384,0x2959d827},
{ a5200,"petetest.bin",8192,0x28278cd6},
{ a5200_ee_16,"pamdiag2.bin",16384,0xe8b130c4},
{ a5200_ee_16,"pamdg23.bin",16384,0xce07d9ad},
{ a5200,"finaltst.bin",8192,0x7ea86e87},
{ a5200,"boogie.bin",4096,0x3bd5fdd6},
{ a5200,"cblast.bin",32768,0x7c988054},
{ a5200,"ccrisis.bin",32768,0xd50e4061},
{ a5200,"koffiyk.bin",32768,0x917be656},
{ a5200,"tempest (atariage).bin",32768,0xa6400e17},
{ a5200,"Boogie",16384,0x7a9d9f85},
{ a5200,"Castle Blast",32768,0x7c988054},
{ a5200,"Castle Crisis",32768,0xd50e4061},
{ a5200,"Koffi - Yellow Kopter",32768,0x917be656},
{ a5200,"Tempest (Atariage)",32768,0xa6400e17},
{ a5200,"Abracadabra",32768, 0x538a852e},
{ a5200,"3-D Tic-Tac-Toe", 32768, 0x38ec4bfe },
{ a5200,"Adventure 2 (Advanced - Special)", 32768, 0xaa600fac },
{ a5200,"Adventure 2 (Easy - Intermediate)", 32768, 0x69cc2cd6 },
{ a5200,"Alien Assault 2121 (A800)", 32768, 0x0dd8c1a0 },
{ a5200,"Analog Classics #1 (A800)", 32768, 0x3e382e45 },
{ a5200,"Ant Eater (A800)", 16384, 0x821f0d97 },
{ a5200,"Archon (A800)", 32767, 0x7bef7c2d },
{ a5200,"Asteroids (5200 Hack)", 8192, 0x28ec3d93 },
{ a5200,"Asteroids (A800)(Improved Defense-Slow Flip)", 16384, 0x0ce7a6e6 },
{ a5200,"Asteroids (A800)", 16384, 0x4e4bf0bd },
{ a5200,"Asteroids Vector Edition", 16384, 0xdd5ecbaa },
{ a5200,"Atlantis", 32768, 0xc99db95f },
{ a5200,"Attack of the Mutant Camels (A800)", 32768, 0x15cafede },
{ a5200,"Baby Berks", 32768, 0x8bc856cc },
{ a5200,"Bacterion (A800)", 8192, 0x4a2056d5 },
{ a5200,"Barnstorming", 16384, 0xf9addb80 },
{ a5200,"Basketball (A800)", 16384, 0x84acbf42 },
{ a5200,"Batty Builders (A800)", 32768, 0x67261f79 },
{ a5200,"BC's Quest For Tires (A800)", 32768, 0xa3a16596 },
{ a5200,"Beef Drop - Ultimate SD Digital Edition", 32768, 0x55545848 },
{ a5200,"Beef_Drop Demo (Fixed level 3)", 32768, 0x48a43bae },
{ a5200,"Blowsub", 16384, 0x3aa7bc0e },
{ a5200,"Boogie", 16384, 0x7a9d9f85 },
{ a5200,"BoulderDash (A800)", 32768, 0x00b9a3f4 },
{ a5200_40,"Bounty Bob Strikes Back", 40960, 0x57e7945e },
{ a5200,"Bowling", 16384, 0xd7237961 },
{ a5200,"Buried Bucks (A800)", 32768, 0x1d161671 },
{ a5200,"Captain Beeble (A800)", 32768, 0x2b760c6e },
{ a5200,"Capture The Flag (A800)", 16384, 0xd1d31e79 },
{ a5200,"Caverns Of Mars 2 (A800)", 16384, 0x2fdb70c1 },
{ a5200,"Caverns Of Mars (A800)", 32768, 0xd1b64581 },
{ a5200,"Caverns Of The Lost Miner (A800)", 32768, 0xff93b2db },
{ a5200,"Chess (Parker Brothers) (A800)", 32768, 0x0f6c1af4 },
{ a5200,"Chicken (A800)", 32768, 0xb2d018b1 },
{ a5200,"Chop Suey", 32768, 0x0244c402 }, //Atari800 improperly detects this as an ATARI Basic file.
{ a5200,"Christmas Cart", 16384, 0x38f4a6a4 },
{ a5200,"Claim Jumper (A800)", 16384, 0xb0553a77 },
{ a5200,"Cloud Burst (A800)", 16384, 0x58a0d074 },
{ a5200,"Clowns & Balloons (A800)", 32768, 0x0dafa507 },
{ a5200,"Crossfire (A800)", 32768, 0xd56be4bc },
{ a5200,"Crystal Castles (Clay) (A800)", 32768, 0xd3b10b5d },
{ a5200,"Crystal Castles (A800)", 32768, 0x596F61D1 },
{ a5200,"Curse Of The Lost Miner (A800)", 32768, 0x8cabcad2 },
{ a5200,"Curse Of The Lost Mines (A800)", 32768, 0xc15a1d9d },
{ a5200,"Deluxe Invaders (A800)", 16384, 0xaf796cfc },
{ a5200,"Demon Attack (A800)", 32768, 0x2174730e },
{ a5200,"Desmonds Dungeon (A800)", 32768, 0x1273a5d1 },
{ a5200,"Diamond Mine (A800)", 32768, 0x7882a1c0 },
{ a5200,"Dig Dug 10-9 (A800)", 32768, 0x89fde0da },
{ a5200,"Donkey Kong Arcade (Hack) (A800)", 32768, 0x8eee62a0 },
{ a5200,"Donkey Kong Jr Arcade (Hack) (A800)", 32768, 0x624cf75c },
{ a5200,"Donkey Kong Jr Enhanced (Hack) (A800)", 32768, 0x383a9157 },
{ a5200,"Donkey Kong Jr (A800)", 32768, 0xb136c3f5 },
{ a5200,"Donkey Kong (A800)", 32768, 0xe902c79e },
{ a5200,"Drelbs (A800)", 16384, 0xbce9e1c2 },
{ a5200,"Ducks Ahoy (A800)", 32768, 0x7a10c551 },
{ a5200,"Dust In The Wind", 32768, 0xf92da5f7 },
{ a5200,"Embargo (A800)", 16384, 0x803808cf },
{ a5200,"EMI Pool (A800)", 16384, 0x5b3ceac8 },
{ a5200,"Encounter (A800)", 32768, 0x6bd0efea },
{ a5200,"Enduro (5200)", 8192, 0x327633db },
{ a5200,"ET Phone Home! (A800)", 32768, 0x5e82a934 },
{ a5200,"Fast Eddie (A800)", 32768, 0xbc0d17bd },
{ a5200,"Fast Food (A800)", 16384, 0x246651b1 },
{ a5200,"Fishing Derby (A800)", 16384, 0xf8583e78 },
{ a5200,"Floyd The Droid (A800)", 8192, 0x89b2d7e5 },
{ a5200,"Forbidden Forest - Slinky (A800)", 32768, 0x219615d9 },
{ a5200,"Fort Apocalypse (A800)", 32768, 0x1b809acc },
{ a5200,"Freecell XE (A800)", 32768, 0x2d2a2807 },
{ a5200,"Freeway (A800)", 16384, 0xb506352f },
{ a5200,"Frisky Tom (Mouse speed fix) (Proto)", 32768, 0x37622411 },
{ a5200,"Frostbite 400 (A800)", 16384, 0x97e75867 },
{ a5200,"Galactic Chase (A800)", 8192, 0x4c5f1847 },
{ a5200,"Galaga (Proto) (A800)", 32768, 0xecda2354 },
{ a5200,"Gateway To Apshai (A800)", 32768, 0x59ec9114 },
{ a5200,"Gauntlet Demo", 32768, 0x3f7f9bd9 },
{ a5200,"Gebelli Compilation (A800)", 32768, 0xc05ff97c },
{ a5200,"Gorf (Digital)", 32768, 0x7f732dc9 },
{ a5200,"Gunpowder Charlie (A800)", 8192, 0x8deefa2f },
{ a5200,"Hyperblast! (A800)", 32768, 0x5ae93e04 },
{ a5200,"Intellidiscs", 32768, 0xe76a0fb6 },
{ a5200,"Ixion (A800)", 32768, 0xa84e68b9 },
{ a5200,"Jawbreaker (A800)", 32768, 0xb6150460 },
{ a5200,"Jet Boot Jack (A800)", 32768, 0xaf210f8e },
{ a5200,"Journey To The Planets (A800)", 32768, 0x31498fe6 },
{ a5200,"Jumpman Jr. (A800)", 32768, 0xfb35d43b },
{ a5200,"Juno First (A800)", 32768, 0x34928a3f },
{ a5200,"K-Star Patrol (A800)", 32768, 0xcb5355b9 },
{ a5200,"Kid Grid (A800)", 8192, 0x2ad24e49 },
{ a5200,"Kooky Diver 2021 (A800)", 32768, 0xe64eb7f1 },
{ a5200,"Kooky Klimber 2021 (A800)", 32768, 0xd0fe471b },
{ a5200,"Kooky's Quest 2021 (A800)", 32768, 0xd1425786 },
{ a5200,"Laser Gates (A800)", 32768, 0x73a3f5f4 },
{ a5200,"Magical Fairy Force (A800)", 32768, 0x2619c4f2 },
{ a5200,"Major Blink", 32768, 0xfe9abd19 },
{ a5200,"Mario Bros Arcade (A800)", 32768, 0x0d9ee13e },
{ a5200,"Missile Command Plus (A800)", 32768, 0xda25c34a },
{ a5200,"Mr. Cool (A800)", 32768, 0xb132a38d },
{ a5200,"Ms Pac-Man Encore (A800)", 32768, 0xdaeae9ad },
{ a5200,"Necromancer (A800)", 32768, 0x5b7303ed },
{ a5200,"O'Riley's Mine (A800)", 32768, 0x646bbe82 },
{ a5200,"Oil's Well (A800)", 32768, 0x0f77eb0d },
{ a5200,"Pac-man Fixed Munch", 32768, 0x21966b5c },
{ a5200,"Pac-man Plus (A800)", 32768, 0xd3363d1c },
{ a5200,"Pacman Arcade Demo V2 (A800)", 32768, 0xb3351c89 },
{ a5200,"Pacific Coast Highway (A800)", 32768, 0x4cc139d0 },
{ a5200,"Pastfinder (A800)", 32768, 0x366c9c2a },
{ a5200,"Phobos (A800)", 16384, 0x2fb8412a },
{ a5200,"Phoenix 2021 (A800)", 32768, 0x4ad9e737 },
{ a5200,"Pinhead", 16384, 0x2af2aa4b },
{ a5200,"Piracy 1621 (A800)", 32768, 0x762ec09c },
{ a5200,"Pitfall! (Classics Fix)", 32768, 0x78cd4061 },
{ a5200,"Pitstop (A800)", 32768, 0xc23d81f5 },
{ a5200,"Pooyan (A800)", 32768, 0x28210510 },
{ a5200,"Popeye Arcade (A800)", 32768, 0x87c94e0b },
{ a5200,"Preppie! II (A800)", 32768, 0x790a8be1 },
{ a5200,"Preppie! (A800)", 32768, 0x47dc1314 },
{ a5200,"Protector II (A800)", 32768, 0x2c1615d0 },
{ a5200,"Q-bert (No Button)", 8192, 0xaaf3d843 },
{ a5200,"Rainbow Walker (A800)", 16384, 0xcfe4aa0c },
{ a5200,"Rally Speedway (A800)", 32768, 0xd9e3fb4d },
{ a5200,"Rampage (A800)", 32768, 0xb3f352f2 },
{ a5200,"Ramses' Revenge 2021 BC (A800)", 32768, 0xc5aae92b },
{ a5200,"Raster Music Tracker", 32768, 0xc790a3a0 },
{ a5200,"Ratcatcher (A800)", 32768, 0x17c7708d },
{ a5200,"Realsports Curling", 32768, 0x0b5b6fbb },
{ a5200,"Rob n Banks (A800)", 32768, 0x9c34cc76 },
{ a5200,"Robot Dungeon 2121 (A800)", 32768, 0x971027bd },
{ a5200,"Rockball (A800)", 32768, 0xb975d952 },
{ a5200,"Rolltris (A800)", 32768, 0x39eb84a0 },
{ a5200,"Runner Bear (A800)", 32768, 0x9a4f1056 },
{ a5200,"Satan's Hollow (A800)", 32768, 0xfdf0f296 },
{ a5200,"Savage Pond (A800)", 16384, 0xc1f458e6 },
{ a5200,"Scramble (A800)", 32768, 0x41e48cff },
{ a5200,"Sea Chase (A800)", 16384, 0xa87c92e0 },
{ a5200,"Sea Dragon (A800)", 16384, 0x20b68254 },
{ a5200,"Shamus Case II (A800)", 32768, 0xa0e29983 },
{ a5200,"Shamus (A800)", 32768, 0x04eb6f41 },
{ a5200,"Sinistar (A800)", 32768, 0xfb1429b4 },
{ a5200,"Slime (A800)", 32768, 0x4b098ebc },
{ a5200,"Space Assailants 2121 (A800)", 32768, 0xb10338f5 },
{ a5200,"SpeedAce (A800)", 32768, 0x4e35e0fc },
{ a5200,"Spy Hunter (A800)", 32768, 0x4eff1e32 },
{ a5200,"Star Rider (A800)", 16384, 0xb9a9a96b },
{ a5200,"Tapper (A800)", 32768, 0xc18d30fa },
{ a5200,"Tempest (AtariAge)", 32768, 0x015e08b0 },
{ a5200,"Tennis (A800)", 16384, 0xd7e15040 },
{ a5200,"Thetris (A800)", 32768, 0x2f02d826 },
{ a5200,"TimeRunner (A800)", 32768, 0x6483d20c },
{ a5200,"TimeSlip (A800)", 32768, 0x97a9e3f7 },
{ a5200,"Train 1 (A800)", 32768, 0x6e32458b },
{ a5200,"Train 2 (A800)", 32768, 0x3f26a60c },
{ a5200,"Train 3 (A800)", 32768, 0x8716e7c8 },
{ a5200,"Turmoil (A800)", 32768, 0xe3ae4170 },
{ a5200,"Up'n Down (A800)", 32768, 0xb08ca999 },
{ a5200,"Yahtzee 2021 (A800)", 32768, 0x63a5dc8f },
{ a5200,"Worm War I (A800)", 32768, 0x271fdab5 },
{ a5200,"Yar's Strike (A800)", 8192, 0xd1c6f325 },
{ a5200,"Zaxxon 32k (A800)", 32768, 0xbddfd255 },
{ a5200_64,"Berks4", 65536, 0x56aca9c3 },
{ a5200_64,"Dropzone (A800)", 65536, 0x42214594 },
{ a5200_64,"ET Phone Home! (A800)", 65536, 0x0fd0ef86 },
{ a5200_64,"Laser Hawk (A800)", 65536, 0x2e2bee02 },
{ a5200_64,"Mr. Do (A800)", 65536, 0x4d66d5ab },
{ a5200_64,"M.U.L.E (A800)", 65536, 0x1f21446e },
{ a5200_64,"Oil's Well (Title) (A800)", 65536, 0x6a1ebc7d },
{ a5200_64,"Rampage 64K (A800)", 65536, 0xdf48d7d4 },
{ a5200_64,"Sea Dragon 64k (A800)", 65536, 0x66b4ea6b },
{ a5200_64,"Super Pac-man 64k (A800)", 65536, 0x93866191 },
{ a5200_512,"Bosconian (A800)", 524288, 0xbbc7d63c },
{ -1,"",0,0},
} ;
+262
View File
@@ -0,0 +1,262 @@
#define a800 0 // STD_8, STD_16, XEGS_32
#define a800_40 1 // Bounty Bob
#define a800_WILL_64 2 // 64 KB Williams cartridge
#define a800_XE_07_64 3 // XEGS 64 KB cartridge (banks 0-7)
#define a800_XE_128 4 // XEGS 128 KB cartridge
//#define a800_XE_256 4 // XEGS 256 KB cartridge. Not sure if any exist.
//#define a800_XE_512 5 // XEGS 512 KB cartridge. Not sure if any exist.
//#define a800_XE_1024 6 // XEGS 1 MB cartridge. Not sure if any exist.
#define a800_MAX_128 5 // Atarimax 128 KB Flash cartridge
#define a800_MAX_1024 6 // Atarimax 1 MB Flash cartridge (old)
typedef struct {
int type;
char name[50];
int size;
ULONG crc;
} a800_rom;
a800_rom a800_game[] = {
{ a800,"3-D Tic-Tac-Toe",8192,0x1cf50ebe},
{ a800,"Abracadabra!",16384,0xa35c775d},
{ a800_XE_128,"Ace Of Aces",131072,0xebad3ddb},
{ a800,"Activision Decathlon",16384,0x7cc0118b},
{ a800,"Adventure Creator",16384,0x8746d9da},
{ a800_XE_128,"Airball",131072,0xa0ccb3c1},
{ a800,"Alf In Color Caves",16384,0x79df7f9d},
{ a800,"Alien Ambush",8192,0xad7bc30b},
{ a800,"Alien Garden",8192,0x3e27ed0f},
{ a800,"Alpha Shield",8192,0xa7ade454},
{ a800_MAX_1024,"Alternate Reality- The City (MF) (Proto)",1048576,0x52cbd474},
{ a800_MAX_1024,"Alternate Reality- The Dungeon (MF)v9",1048576,0x9fd8d4d3},
{ a800,"Ant Eater",8192,0xc7290722},
{ a800,"Archon- The Light And The Dark",32768,0x2636829f},
{ a800_MAX_128,"Arkanoid I, II, III (MF)",131072,0x70f7bbe5},
{ a800,"Asteroids",8192,0xf9fff4a4},
{ a800,"Astro Chase (First Star Software)",16384,0x18752991},
{ a800,"Astro Chase",16384,0x11f1c7fa},
{ a800,"Atlantis",8192,0xbe0b390c},
{ a800,"Attack At EP-CYG-4",163834,0xdca02ca0},
{ a800,"Attack Of The Mutant Camels",163834,0xc933d741},
{ a800_XE_07_64,"Ballblazer",65536,0x820e5ce5},
{ a800,"Baseball",16384,0x065c3fd2},
{ a800,"Basketball",8192,0x79934851},
{ a800_XE_07_64,"Battlezone",65536,0x692515f2},
{ a800,"BC's Quest For Tires",16384,0xdddc6e36},
{ a800,"Beamrider",16384,0x2b05b8df},
{ a800_MAX_128,"Beyond Castle Wolfenstein (MF)",131926,0xf454689b},
{ a800,"Blue Max",32768,0x003f41ac},
{ a800,"Blaster",16384,0xce1126a2},
{ a800,"Boulderdash",16384,0xaf778329},
{ a800,"Boulders And Bombs",16384,0xab2ec21c},
{ a800_40,"Bounty Bob Strikes Back!",40960,0x0d00f072},
{ a800,"Bristles",16384,0x4263d64d},
{ a800_XE_07_64,"Bruce Lee (Repro)",65536,0x255dfc59},
{ a800,"Buck Rogers - Planet Of Zoom",16384,0x84dd597c},
{ a800,"Captain Beeble",16384,0xad8400b1},
{ a800,"Carnival Massacre (CS)",16384,0xea764851},
{ a800,"Carnival Massacre",16384,0x1baf0c97},
{ a800,"Castle Crisis",32768,0x47acda14},
{ a800,"Castle Hassle",16384,0x5a9e938a},
{ a800,"Castles And Keys",16384,0xbe14c091},
{ a800,"Caverns Of Mars",16384,0x8b9b2f5e},
{ a800,"Centipede",8192,0x44bb1842},
{ a800,"Chess",8192,0x72860db1},
{ a800,"Chicken",8192,0x1ab4d8d8},
{ a800,"Choplifter! (Broderbund)",16384,0x3ebc05ff},
{ a800_XE_07_64,"Choplifter!",65536,0xd426eccc},
{ a800,"Claim Jumper",16384,0x1a333c4a},
{ a800,"Cloudburts",8192,0x259aa18b},
{ a800_XE_128,"Commando",131072,0x28288df4}, // falsely autodetected as an xex file
{ a800,"Computer Chess",8192,0x5ce06e94},
{ a800,"Computer War",16384,0x4922aac6},
{ a800_MAX_1024,"Conan (MF)",1048576,0x25feb642},
{ a800,"Congo Bongo",16384,0x7a588045},
{ a800,"Cosmic Life",16384,0x919eaaa9},
{ a800,"Cosmic Tunnels",16384,0xad56c2bf},
{ a800,"Crossfire",8192,0x4d7e0503},
{ a800,"Crystal Castles",32768,0x998fa803},
{ a800,"Dance Fantasy",8192,0xfaec94e7},
{ a800_XE_07_64,"Dark Chambers",65536,0xfa2f132c},
{ a800_XE_07_64,"David's Midnight Magic",65536,0xb7ca61a2},
{ a800,"Defender",16384,0x782a81e4},
{ a800,"Deluxe Invaders",8192,0x15dc9b31},
{ a800,"Demo Cart",16384,0x9bedcdf3},
{ a800,"Demon Attack",8192,0x91328072},
{ a800_XE_07_64,"Desert Falcon",65536,0xa8f9324d},
{ a800,"Diamond Mine",16384,0xd8f9b867},
{ a800,"Dig Dug (1983)",16384,0xfdbc57ed},
{ a800,"Dig Dug",16384,0x6d68114e},
{ a800,"Donkey Kong Jr.",16384,0xa4eb70ef},
{ a800,"Donkey Kong",16384,0xf2b76a27},
{ a800,"Dreadnaught Factor",8192,0xc26fbb5b},
{ a800,"Droids",8192,0x5bb0c159},
{ a800,"Ducks Ahoy",16384,0x4cdfceb9},
{ a800_WILL_64,"DynaKillers",65536,0xad050724},
{ a800,"Eastern Front (1941)",16384,0xccff4a03},
{ a800,"Enduro",8192,0xa538a1bb},
{ a800_MAX_128,"Eidolon- The (MF)",131072,0x46f363f7},
{ a800,"Embargo",8192,0x07b1560c},
{ a800,"Espial",16384,0x64946757},
{ a800,"E.T. Phone Home",16384,0xbce4ef51},
{ a800,"Fantastic Voyage",8192,0x7bde2593},
{ a800,"Fast Eddie",8192,0x53ac386a},
{ a800,"Fast Food",8192,0x77223249},
{ a800_XE_128,"Fight Night",131072,0x4440d167},
{ a800,"Final Legacy",16384,0x6bd0d8e4},
{ a800,"Final Orbit",8192,0x177007e9},
{ a800,"Firebird",8192,0xe3c0b5f1},
{ a800,"Flapper",16384,0x18803c52},
{ a800_XE_128,"Flight Simulator II",131072,0x10cfc489},
{ a800,"Flip And Flop",16384,0x8ae057be},
{ a800_MAX_1024,"Flob 1.0.3b",1048576,0xff236e36},
{ a800,"Food Fight",32767,0x4236f0ea},
{ a800,"Fort Apocalypse",16384,0xf79b33f0},
{ a800,"Fortune Hutner",8192,0x03255972},
{ a800,"Frogger II - Threeedeep!",16384,0xed35f49c},
{ a800,"Frogger",8192,0x40e9476c},
{ a800,"Galaxian",8192,0xd60027be},
{ a800,"Gateway To Apshai",16384,0x3a0c6eb0},
{ a800_XE_128,"G.A.T.O.",131072,0xab06a3f5},
{ a800_MAX_128,"Gauntlet (MF)",131072,0x48cface0},
{ a800,"Gold Mine",8192,0x8459b11e},
{ a800,"Gorf",8192,0x90d0c7d7},
{ a800,"Gridrunner",8192,0x752dd5fe},
{ a800,"Gyruss",16384,0x1da47d01},
{ a800,"H.E.R.O.",16384,0x6062d3ce},
{ a800,"Halftime Battlin Bands",16384,0x8d14b5d3},
{ a800_XE_07_64,"Hardball",65536,0xbf0c6df2},
{ a800,"Hypnotic Land",16384,0x4fb75909},
{ a800,"Into The Eagles Nest",32768,0xf31321c2},
{ a800,"James Bond 007",16384,0x19b4e3a1},
{ a800,"Jawbreaker II",8192,0xe2a63a2d},
{ a800_MAX_1024,"Jim Slide XL",1048576,0x5f74de4a},
{ a800,"Journey To The Planets",16384,0xdce59b65},
{ a800,"Joust",16384,0xf6ec618c},
{ a800,"Jumbo Jet Pilot",16384,0xf046332b},
{ a800_MAX_128,"Jumpman",131072,0x4b7beb03},
{ a800,"Jumpman Jr.",16384,0x6c79bbad},
{ a800,"Jungle Hunt",16384,0x1847a7d4},
{ a800,"K-Razy Antiks",8192,0x84ab21b0},
{ a800,"K-razy Kritters (K-Byte)",8192,0x50354927},
{ a800,"K-razy Kritters",8192,0xf854a3b4},
{ a800,"K-razy Shoot-Out (CBS)",8192,0x636a01f5},
{ a800,"K-razy Shoot-Out (K-Byte)",8192,0x4300f6ff},
{ a800,"K-Star Patrol",8192,0x44c71fae},
{ a800,"Kangaroo",16384,0x1ef94906},
{ a800_XE_128,"Karateka",131072,0x97646f16},
{ a800,"Keystone Kapers",8192,0x465e1763},
{ a800,"Kickback",8192,0x2480ed0a},
{ a800_MAX_128,"Koronis Rift (MF)",131072,0xd385b89c},
{ a800_XE_128,"Lode Runner",131072,0x7790f474},
{ a800_MAX_1024,"Lords Of Conquest (MF)",1048576,0x3d6c01bb},
{ a800_MAX_1024,"M.U.L.E. (MF)",1048576,0x0b84f03e},
{ a800,"Major League Hockey",8192,0x4ffbc999},
{ a800_XE_07_64,"Mario Bros. XE",65536,0x7ba07c34},
{ a800,"M.A.S.H.",8192,0xfa041093},
{ a800,"Matterhorn",16384,0xdcc308cf},
{ a800,"Megamania",8192,0xb3c5130c},
{ a800_XE_128,"Mean 18 (Proto)",131072,0x0ee74a89},
{ a800_XE_128,"Midi Maze (Proto)",131072,0x193a53f6},
{ a800,"Millipede",16384,0xfb7e45da},
{ a800,"Miner 2049er",16384,0x6b1478bf},
{ a800,"Missile Command",8192,0xd2e36392},
{ a800,"Mogul Maniac",16384,0x0c391600},
{ a800,"Monster Maze",16384,0x37049e57},
{ a800,"Moon Patrol",16384,0xb845edb8},
{ a800,"Mountain King",8192,0x79748c93},
{ a800,"Mr. Cool",8192,0x1345d10c},
{ a800,"Mr. Do's Castle",8192,0xf1b9a24a},
{ a800,"Mr. TNT",8192,0x701dbdea},
{ a800,"Mrs. Pac-Man",16384,0xf91d18cf},
{ a800_MAX_128,"Mysterious Adventures (MF)",131072,0xadd506c5},
{ a800,"Necromancer",16384,0x39250ff2},
{ a800,"Nightstrike",8192,0x61245a75},
{ a800,"Oil's Well",16384,0x030ecad6},
{ a800,"One-On-One - Dr J. Vs Larry Bird",32768,0xab060567},
{ a800_MAX_1024,"onEscape (121422) (MF)",1048576,0x083fb021},
{ a800,"Orc Attack",16384,0xfbfaefcd},
{ a800,"Ozzy's Orchard",16384,0x1554b983},
{ a800,"Pac-Man",8192,0x61cf6167},
{ a800_MAX_128,"Pac-Man Arcade",131072,0x19bc1482},
{ a800,"Pastfinder",16384,0x12694c3f},
{ a800,"Peanut Butter Panic",8192,0xcdeb7759},
{ a800,"Pengo",16384,0xd8a9fe0a},
{ a800,"Picnic Paranoia",16384,0xe386a621},
{ a800,"Pitfall! II - The Lost Caverns",16384,0x1668cf3b},
{ a800,"Pitfall!",8192,0xb58bdf1c},
{ a800,"Pitstop",16384,0xd49ebf91},
{ a800,"Plattermania",8192,0x6cef6f94},
{ a800,"Pole Position",16384,0x581570C4},
{ a800,"Pool 400",8192,0xa6c2130f},
{ a800,"Popeye",16384,0x00fce79a},
{ a800,"Porky's",16384,0x1733d3fc},
{ a800,"Powerstar",16384,0xdc0dca6e},
{ a800,"Princes And The Frog",8192,0x7ce79281},
{ a800_MAX_1024,"Prince of Persia 211206 (MF)",1048576,0x52df819c},
{ a800,"Protector II",16384,0x374f311f},
{ a800,"Q-bert",8192,0xff3f0472},
{ a800,"Qix",8192,0x967b8051},
{ a800,"Rack'em Up",16384,0x5335d935},
{ a800,"Rally Speedway",16384,0x0a0f6ea2},
{ a800,"Realsports Football",16384,0x5e8951f4},
{ a800,"Realsports Tennis",16384,0x9a34cbdc},
{ a800_XE_07_64,"Rescue On Fractalus",65536,0x1ca549ad},
{ a800,"Risk (Proto)",8192,0x688b0a0c},
{ a800,"River Raid",8192,0x6e601d81},
{ a800,"River Rescue",16384,0xc018c8a0},
{ a800,"Robotron 2084",16384,0x528fc44a},
{ a800,"Satan's Hollow",16384,0x0f7c7934},
{ a800_MAX_128,"Scott Adams Adventures (MF)",131072,0x5446bcb1},
{ a800,"Sea Chase",8192,0x99b5a1dd},
{ a800,"Sea Fox",16384,0x932cc9a8},
{ a800,"Serpentine",8192,0x1b555b41},
{ a800,"Shamus",16384,0xbd3f06ee},
{ a800,"Silicon Warrior",16384,0x0736c8ae},
{ a800,"Slime",16384,0x1babcad6},
{ a800,"Soccer",8192,0x784c7060},
{ a800_MAX_1024,"Space Harrier",1048576,0xca98abfc},
{ a800,"Space Invaders",8192,0x6c811a10},
{ a800,"Space Shuttle",16384,0x66832f68},
{ a800,"Spark Bugs",8192,0xf56eced2},
{ a800,"Speedway Blast",8192,0xf895cc47},
{ a800,"Spider City",8192,0x8f8c3841},
{ a800,"Springer",16384,0x81466b55},
{ a800,"Spy Hunter",16384,0x34df8ffc},
{ a800,"Squish Em",8192,0xe01600b8},
{ a800,"Stargate (Proto)",16384,0xf527b721},
{ a800,"Star Raiders II",32768,0x737d4196},
{ a800,"Star Raiders",8192,0x5ec023ba},
{ a800,"Star Trek - Strategic Operations Simulator",16384,0x9df169d9},
{ a800,"Star Wars - Arcade Game - The",16384,0xaea795f7},
{ a800,"Star Wars - Death Star Battle",16384,0xd9f5cac7},
{ a800,"Starion",16384,0x23faf9b3},
{ a800,"Submarine Commander",16384,0x77198b2b},
{ a800_MAX_1024,"Summer Games (MF)",1048576,0x92325dc3},
{ a800_XE_128,"Summer Games",131072,0x95e6932d},
{ a800,"Super Cobra",8192,0x2af38d2f},
{ a800,"Super Pac-Man (Early Proto)",16384,0xb985be78},
{ a800,"Super Pac-Man (Proto)",16384,0xb518dda8},
{ a800,"Super Zaxxon",16384,0x9e64e13b},
{ a800,"Survival Of The Fittest",8192,0x7f48fbc5},
{ a800_XE_07_64,"Tapper (Cart)",65536,0xeff12440},
{ a800_XE_07_64,"Thunderfox",65536,0xb15ccef2},
{ a800,"Topper",16384,0x0286eea6},
{ a800_XE_07_64,"Tower Toppler (Proto)",65536,0x6b5333bd},
{ a800,"Track And Field",16384,0x9e2484c8},
{ a800,"Turmoil",8192,0xfe48aadf},
{ a800,"Typo Attack",16384,0x89da4ff7},
{ a800,"Typo",8192,0x70585854},
{ a800_MAX_1024,"Ultima II - Revenge of the Enchantress",1048576,0xd2a6db16},
{ a800_MAX_1024,"Ultima III (MF)",1048576,0xb132a1da},
{ a800_MAX_1024,"Ultima IV (MF)",1048576,0x62b1571f},
{ a800,"Up'n Down",16384,0x53ea3bf6},
{ a800,"Wizard Of Wor",16384,0x8017e56a},
{ a800_MAX_128,"World Karate Championship (MF)",131072,0x83c87b17},
{ a800,"Worm War I",8291,0x79934b01},
{ a800_XE_128,"Xenophobe",131072,0x68466666},
{ a800,"Zaxxon",16384,0x21579706},
{ a800,"Zenji",16384,0xebc6ec2e},
{ a800,"Zone Ranger",16384,0x8f1e72e7},
{ -1,"",0,0},
} ;
+1 -1
View File
@@ -22,7 +22,7 @@ void Add_Option(const char* option)
first++;
}
sprintf(XARGV[PARAMCOUNT++],"%s\0",option);
sprintf(XARGV[PARAMCOUNT++],"%s", option);
}
int pre_main(const char *argv)
+236 -90
View File
@@ -3,22 +3,17 @@
#include "retroscreen.h"
#include "platform.h"
#include "vkbd.h"
#include "input.h"
#include "pokey.h"
//CORE VAR
#ifdef _WIN32
char slash = '\\';
#else
char slash = '/';
#endif
extern const char *retro_save_directory;
extern const char *retro_system_directory;
extern const char *retro_content_directory;
char RETRO_DIR[512];
char DISKA_NAME[512]="\0";
char DISKB_NAME[512]="\0";
char TAPE_NAME[512]="\0";
extern void Screen_SetFullUpdate(int scr);
//extern void retro_message(const char* text, unsigned int frames, int alt);
long frame=0;
unsigned long Ktime=0 , LastFPSTime=0;
@@ -35,48 +30,64 @@ short signed int SNDBUF[1024*2];
int snd_sampler_pal = 44100 / 50;
int snd_sampler_ntsc = 44100 / 60;
//PATH
char RPATH[512];
//EMU FLAGS
int NPAGE=-1, KCOL=1, BKGCOLOR=0;
int SHOWKEY=-1;
int VKBD_OPACITY=-1;
int NPAGE = -1, KCOL = 1, BKGCOLOR = 0;
int SHOWKEY = -1, SHOWKEYDELAY = 0;
int VKBD_OPACITY = -1;
#if defined(ANDROID) || defined(__ANDROID__)
int MOUSE_EMULATED=1;
int MOUSE_EMULATED = 1;
#else
int MOUSE_EMULATED=-1;
int MOUSE_EMULATED = -1;
#endif
int SHIFTON=-1,MOUSEMODE=-1,PAS=4;
int SND=1; //SOUND ON/OFF
int pauseg=0; //enter_gui
int touch=-1; // gui mouse btn
//JOY
int al[2][2];//left analog1
int ar[2][2];//right analog1
unsigned char MXjoy[4]; // joy
int16_t joypad_bits[4];
extern UBYTE consol_mask;
#define JOYRANGE_UP_VALUE -16384 /* Joystick ranges in XY */
#define JOYRANGE_DOWN_VALUE 16383
#define JOYRANGE_LEFT_VALUE -16384
#define JOYRANGE_RIGHT_VALUE 16383
extern int a5200_joyhack;
// retro core option variables
extern int atari_joyhack;
extern int keyboard_type;
extern int pot_analog_deadzone;
extern int paddle_mode;
extern int paddle_speed;
//MOUSE
extern int INPUT_joy_5200_center;
extern int INPUT_joy_5200_min;
extern int INPUT_joy_5200_max;
extern int INPUT_digital_5200_min;
extern int INPUT_digital_5200_center;
extern int INPUT_digital_5200_max;
//MOUSE Is this even tied to anything?
extern int pushi; // gui mouse btn
int gmx,gmy; //gui mouse
int mouse_wu=0,mouse_wd=0;
//KEYBOARD
char Key_Sate[512];
char Key_Sate2[512];
static char old_Key_Sate[512];
int mbt[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
//Atari800 EMU mouse
extern UBYTE POKEY_POT_input[8];
extern int INPUT_mouse_pot_min;
extern int INPUT_mouse_pot_max;
//KEYBOARD
char Key_State[512];
static char old_Key_State[512];
int mbt[4][16] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } };
//STATS GUI
int BOXDEC= 32+2;
@@ -84,7 +95,6 @@ int STAT_BASEY;
/*static*/ retro_input_state_t input_state_cb;
static retro_input_poll_t input_poll_cb;
extern void retro_audio_cb( short l, short r);
extern bool libretro_supports_bitmasks;
@@ -114,13 +124,14 @@ int slowdown=0;
#define RETRO_DEVICE_ATARI_KEYBOARD RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_KEYBOARD, 0)
#define RETRO_DEVICE_ATARI_JOYSTICK RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1)
#define RETRO_DEVICE_ATARI_5200_JOYSTICK RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 2)
void texture_uninit(void) { }
void texture_init(void)
{
memset(Retro_Screen, 0, sizeof(Retro_Screen));
memset(old_Key_Sate ,0, sizeof(old_Key_Sate));
memset(old_Key_State ,0, sizeof(old_Key_State));
gmx=(retrow/2)-1;
gmy=(retroh/2)-1;
@@ -151,7 +162,13 @@ void retro_sound_update(void)
}
}
extern void vkbd_key(int key,int pressed);
//extern void vkbd_key(int key,int pressed);
void Screen_SetFullUpdate(int scr)
{
if (scr == 0 || scr > 1)
memset(Retro_Screen, 0, sizeof(Retro_Screen));
}
void vkbd_key(int key,int pressed)
{
@@ -159,14 +176,14 @@ void vkbd_key(int key,int pressed)
{
if(SHIFTON==1)
;
Key_Sate[key]=1;
Key_State[key]=1;
// key is being held down
}
else
{
if(SHIFTON==1)
;
Key_Sate[key]=0;
Key_State[key]=0;
// key is being RELEASE
}
}
@@ -229,7 +246,7 @@ void retro_virtualkb(void)
virtual_kdb(( char *)Retro_Screen,vkx,vky);
i=8;
i=0; // swapped Button 1 and 2 definitions ( used to be 8 )
if( (joypad_bits[0] & (1 << i)) && vkflag[4]==0 )
vkflag[4]=1;
else if( !(joypad_bits[0] & (1 << i)) && vkflag[4]==1 )
@@ -310,12 +327,6 @@ void retro_virtualkb(void)
}
}
void Screen_SetFullUpdate(int scr)
{
if(scr==0 ||scr>1)
memset(Retro_Screen, 0, sizeof(Retro_Screen));
}
void Process_key(void)
{
int i;
@@ -324,13 +335,13 @@ void Process_key(void)
return;
for(i=0;i<320;i++)
Key_Sate[i]=input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0,i) ? 0x80: 0;
Key_State[i]=input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0,i) ? 0x80: 0;
if(memcmp( Key_Sate,old_Key_Sate , sizeof(Key_Sate) ) )
if(memcmp( Key_State,old_Key_State , sizeof(Key_State) ) )
{
for(i=0;i<320;i++)
for(i=0;i<320;i++)
{
if(Key_Sate[i] && Key_Sate[i]!=old_Key_Sate[i] )
if(Key_State[i] && Key_State[i]!=old_Key_State[i] )
{
if(i==RETROK_RCTRL)
{
@@ -352,7 +363,7 @@ void Process_key(void)
//retro_key_down(i);
}
else if ( !Key_Sate[i] && Key_Sate[i]!=old_Key_Sate[i] )
else if ( !Key_State[i] && Key_State[i]!=old_Key_State[i] )
{
if(i==RETROK_RCTRL)
{
@@ -378,7 +389,52 @@ void Process_key(void)
}
}
memcpy(old_Key_Sate,Key_Sate , sizeof(Key_Sate) );
memcpy(old_Key_State,Key_State , sizeof(Key_State) );
}
int Atari_POT(int input)
{
int which = input / 2;
int xval, yval, pval, result;
//if (consol_mask == 0x0f)
// return 228;
/* account for Joystick swap enabled */
if (atari_joyhack == 2)
which = (which + 1) % 2;
xval = input_state_cb(which, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X);
yval = input_state_cb(which, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y);
pval = (input & 1) ? yval : xval;
if ((pval > -pot_analog_deadzone) && (pval < pot_analog_deadzone))
return INPUT_joy_5200_center;
/* Convert to amplitude */
float amplitude = (float)((pval > pot_analog_deadzone) ?
(pval - pot_analog_deadzone) :
(pval + pot_analog_deadzone)) /
(float)(LIBRETRO_ANALOG_RANGE - pot_analog_deadzone);
/* Map to Atari 5200 values */
if (amplitude >= 0.0f)
result = (JOY_5200_CENTER + (unsigned int)(((float)(INPUT_joy_5200_max - JOY_5200_CENTER) * amplitude) + 0.5f));
else
result = (JOY_5200_CENTER - (unsigned int)(((float)(JOY_5200_CENTER - INPUT_joy_5200_min) * -amplitude) + 0.5f));
/* for debug purposes */
//if (input == 1)
//{
// char msg[256];
// //sprintf(msg, "X=%f, Y=%f, Deadzone=%f. Result- %i\n", xval / (float)LIBRETRO_ANALOG_RANGE, yval / (float)LIBRETRO_ANALOG_RANGE, (float)pot_analog_deadzone, result);
// sprintf(msg, "Joy Min=%i, Joy Max=%i. Result- %i\n", INPUT_joy_5200_max, INPUT_joy_5200_min, result);
// retro_message(msg, 60, 0);
//}
return result;
}
int Retro_PollEvent()
@@ -386,13 +442,12 @@ int Retro_PollEvent()
// RETRO B Y SLT STA UP DWN LEFT RGT A X L R L2 R2 L3 R3
// INDEX 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int SAVPAS=PAS;
int i,j;
static int vbt[4][16]={
{0x0,0x0,0x0,0x0,0x01,0x02,0x04,0x08,0x80,0x40,0x0,0x0,0x0,0x0,0x0,0x0},
{0x0,0x0,0x0,0x0,0x01,0x02,0x04,0x08,0x80,0x40,0x0,0x0,0x0,0x0,0x0,0x0},
{0x0,0x0,0x0,0x0,0x01,0x02,0x04,0x08,0x80,0x40,0x0,0x0,0x0,0x0,0x0,0x0},
{0x0,0x0,0x0,0x0,0x01,0x02,0x04,0x08,0x80,0x40,0x0,0x0,0x0,0x0,0x0,0x0},
{0x80,0x0,0x0,0x0,0x01,0x02,0x04,0x08,0x10,0x40,0x0,0x0,0x0,0x0,0x0,0x0},
{0x80,0x0,0x0,0x0,0x01,0x02,0x04,0x08,0x10,0x40,0x0,0x0,0x0,0x0,0x0,0x0},
{0x80,0x0,0x0,0x0,0x01,0x02,0x04,0x08,0x10,0x40,0x0,0x0,0x0,0x0,0x0,0x0},
{0x80,0x0,0x0,0x0,0x01,0x02,0x04,0x08,0x10,0x40,0x0,0x0,0x0,0x0,0x0,0x0},
};
input_poll_cb();
@@ -414,12 +469,13 @@ int Retro_PollEvent()
int16_t mouse_x,mouse_y;
mouse_x=mouse_y=0;
if(SHOWKEY==-1 && pauseg==0)Process_key();
if (SHOWKEY==-1 && pauseg==0)
Process_key();
//Joy mode
for(j=0;j<4;j++)
{
for(i=4;i<10;i++)
for(i=0;i<16;i++)
{
if(joypad_bits[j] & (1 << i))
MXjoy[j] |= vbt[j][i]; // Joy press
@@ -428,21 +484,12 @@ int Retro_PollEvent()
}
}
if(a5200_joyhack) //hack for robotron right analog act as Joy1
if (atari_joyhack == 1 && !paddle_mode) //hack for robotron right analog act as Joy1
{
#if 0
int x,y;
#endif
//emulate Joy1 with joy analog right
ar[0][0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X));
ar[0][1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y));
#if 0
x=ar[0][0];
y=ar[0][1];
#endif
/* Directions */
if (ar[0][1] <= JOYRANGE_UP_VALUE)
@@ -455,40 +502,141 @@ int Retro_PollEvent()
else if (ar[0][0] >= JOYRANGE_RIGHT_VALUE)
MXjoy[1] |= 0x08;
}
else if (atari_joyhack == 2 && !paddle_mode) //hack for Joy 1 / 2 swap.
{
//emulate Joy1 with joy analog right
al[0][0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X));
al[0][1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y));
if (libretro_supports_bitmasks)
joypad_bits[1] = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK);
else
{
joypad_bits[1] = 0;
joypad_bits[1] |= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK) ? 1 : 0;
}
if(atari_devices[0]==RETRO_DEVICE_ATARI_JOYSTICK)
for (i = 0 ; i < 16; i++)
{
if (joypad_bits[1] & (1 << i))
MXjoy[1] |= vbt[0][i]; // Joy press
else if (MXjoy[1] & vbt[0][i])
MXjoy[1] &= ~vbt[0][i]; // Joy press
}
/* Directions */
if (al[0][1] <= JOYRANGE_UP_VALUE)
MXjoy[1] |= 0x01;
else if (al[0][1] >= JOYRANGE_DOWN_VALUE)
MXjoy[1] |= 0x02;
if (al[0][0] <= JOYRANGE_LEFT_VALUE)
MXjoy[1] |= 0x04;
else if (al[0][0] >= JOYRANGE_RIGHT_VALUE)
MXjoy[1] |= 0x08;
}
if ( atari_devices[0] != RETRO_DEVICE_ATARI_KEYBOARD)
{
//shortcut for joy mode only
//Button B Y SLT STA
// 0 1 2 3
for(i=0;i<4;i++)
{
if ( (joypad_bits[0] & (1 << i)) && mbt[i]==0 )
mbt[i]=1;
else if (mbt[i]==1 && !(joypad_bits[0] & (1 << i)) )
{
mbt[i]=0;
if(i==2)
MOUSE_EMULATED = -MOUSE_EMULATED;
}
}
//Button L R L2 R2 L3 R3
// 10 11 12 13 14 15
for(i=10;i<16;i++)
{
if ( (joypad_bits[0] & (1 << i)) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && !(joypad_bits[0] & (1 << i)) )
{
mbt[i]=0;
if(i==14)
SHOWKEY = -SHOWKEY;
}
}
}//if atari_devices=joy
for (i = 0; i < 16; i++)
{
for (int j = 0; j < 4; j++)
{
if ((joypad_bits[j] & (1 << i)) && mbt[j][i] == 0)
mbt[j][i] = 1;
else if (mbt[j][i] == 1 && !(joypad_bits[j] & (1 << i)))
{
mbt[j][i] = 0;
#if defined(ANDROID) || defined(__ANDROID__)
/* apparently this is used by the ANDROID port? Keep in for now. Android only*/
if(i==2)
MOUSE_EMULATED = -MOUSE_EMULATED;
#endif
}
}
}
/* Huh? */
//for(i=0;i<4;i++)
//{
// if ( (joypad_bits[0] & (1 << i)) && mbt[i]==0 )
// mbt[i]=1;
// else if (mbt[i]==1 && !(joypad_bits[0] & (1 << i)) )
// {
// mbt[i]=0;
// //if(i==2) /* hard coded? android only? */
// // MOUSE_EMULATED = -MOUSE_EMULATED;
// }
//}
////Button L R L2 R2 L3 R3
//// 10 11 12 13 14 15
//for(i=10;i<16;i++)
//{
// if ( (joypad_bits[0] & (1 << i)) && mbt[i]==0 )
// mbt[i]=1;
// else if ( mbt[i]==1 && !(joypad_bits[0] & (1 << i)) )
// {
// mbt[i]=0;
// //if(i==14) /* removed can be defined in controller settings screen? */
// //SHOWKEY = -SHOWKEY;
// }
//}
}
else //Emulate joystick controls with keyboard/retro_keyboard only Joy 1 atm... experimental
{
// these are the same for both computer and 5200
if (Key_State[RETROK_KP8]) // up
MXjoy[0] |= 0x01;
else if (Key_State[RETROK_KP2]) // down
MXjoy[0] |= 0x02;
if (Key_State[RETROK_KP4]) // left
MXjoy[0] |= 0x04;
else if (Key_State[RETROK_KP6]) // right
MXjoy[0] |= 0x08;
if (Key_State[RETROK_RALT]) // fire 1
MXjoy[0] |= 0x80;
// 5200 fire button 2
if (Atari800_machine_type == Atari800_MACHINE_5200 && !UI_is_active)
if ( Key_State[RETROK_RCTRL])
INPUT_key_shift = 1;
}
if (paddle_mode)
{
for (int i = 0; i < 4; i++)
{
int pval = input_state_cb(i, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X);
if ((pval < -pot_analog_deadzone) || (pval > pot_analog_deadzone))
{
if (pval > 0)
POKEY_POT_input[i] -= paddle_speed;
else
POKEY_POT_input[i] += paddle_speed;
}
else
{
if (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_RIGHT))
POKEY_POT_input[i] -= paddle_speed;
if (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT))
POKEY_POT_input[i] += paddle_speed;
}
if (POKEY_POT_input[i] < INPUT_mouse_pot_min)
POKEY_POT_input[i] = INPUT_mouse_pot_min;
if (POKEY_POT_input[i] > INPUT_mouse_pot_max)
POKEY_POT_input[i] = INPUT_mouse_pot_max;
}
}
if(MOUSE_EMULATED==1)
{
@@ -503,10 +651,8 @@ int Retro_PollEvent()
mouse_y += PAS;
if (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_UP))
mouse_y -= PAS;
mouse_l = (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_A)) ? 1 : 0;
mouse_r = (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_B)) ? 1 : 0;
PAS=SAVPAS;
mouse_l = (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_B)) ? 1 : 0;
mouse_r = (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_A)) ? 1 : 0;
slowdown=1;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,63 @@
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (memory_stream.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBRETRO_SDK_FILE_MEMORY_STREAM_H
#define _LIBRETRO_SDK_FILE_MEMORY_STREAM_H
#include <stdint.h>
#include <stddef.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef struct memstream memstream_t;
memstream_t *memstream_open(unsigned writing);
void memstream_close(memstream_t *stream);
uint64_t memstream_read(memstream_t *stream, void *data, uint64_t bytes);
uint64_t memstream_write(memstream_t *stream, const void *data, uint64_t bytes);
int memstream_getc(memstream_t *stream);
void memstream_putc(memstream_t *stream, int c);
char *memstream_gets(memstream_t *stream, char *buffer, size_t len);
uint64_t memstream_pos(memstream_t *stream);
void memstream_rewind(memstream_t *stream);
int64_t memstream_seek(memstream_t *stream, int64_t offset, int whence);
void memstream_set_buffer(uint8_t *buffer, uint64_t size);
uint64_t memstream_get_last_size(void);
uint64_t memstream_get_ptr(memstream_t *stream);
RETRO_END_DECLS
#endif
@@ -0,0 +1,191 @@
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (memory_stream.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <streams/memory_stream.h>
/* TODO/FIXME - static globals */
static uint8_t* g_buffer = NULL;
static uint64_t g_size = 0;
static uint64_t last_file_size = 0;
struct memstream
{
uint64_t size;
uint64_t ptr;
uint64_t max_ptr;
uint8_t *buf;
unsigned writing;
};
void memstream_set_buffer(uint8_t *buffer, uint64_t size)
{
g_buffer = buffer;
g_size = size;
}
uint64_t memstream_get_last_size(void)
{
return last_file_size;
}
memstream_t *memstream_open(unsigned writing)
{
memstream_t *stream;
if (!g_buffer || !g_size)
return NULL;
stream = (memstream_t*)malloc(sizeof(*stream));
if (!stream)
return NULL;
stream->buf = g_buffer;
stream->size = g_size;
stream->ptr = 0;
stream->max_ptr = 0;
stream->writing = writing;
g_buffer = NULL;
g_size = 0;
return stream;
}
void memstream_close(memstream_t *stream)
{
if (!stream)
return;
last_file_size = stream->writing ? stream->max_ptr : stream->size;
free(stream);
}
uint64_t memstream_get_ptr(memstream_t *stream)
{
return stream->ptr;
}
uint64_t memstream_read(memstream_t *stream, void *data, uint64_t bytes)
{
uint64_t avail = 0;
if (!stream)
return 0;
avail = stream->size - stream->ptr;
if (bytes > avail)
bytes = avail;
memcpy(data, stream->buf + stream->ptr, (size_t)bytes);
stream->ptr += bytes;
if (stream->ptr > stream->max_ptr)
stream->max_ptr = stream->ptr;
return bytes;
}
uint64_t memstream_write(memstream_t *stream,
const void *data, uint64_t bytes)
{
uint64_t avail = 0;
if (!stream)
return 0;
avail = stream->size - stream->ptr;
if (bytes > avail)
bytes = avail;
memcpy(stream->buf + stream->ptr, data, (size_t)bytes);
stream->ptr += bytes;
if (stream->ptr > stream->max_ptr)
stream->max_ptr = stream->ptr;
return bytes;
}
int64_t memstream_seek(memstream_t *stream, int64_t offset, int whence)
{
uint64_t ptr;
switch (whence)
{
case SEEK_SET:
ptr = offset;
break;
case SEEK_CUR:
ptr = stream->ptr + offset;
break;
case SEEK_END:
ptr = (stream->writing ? stream->max_ptr : stream->size) + offset;
break;
default:
return -1;
}
if (ptr <= stream->size)
{
stream->ptr = ptr;
return 0;
}
return -1;
}
void memstream_rewind(memstream_t *stream)
{
memstream_seek(stream, 0L, SEEK_SET);
}
uint64_t memstream_pos(memstream_t *stream)
{
return stream->ptr;
}
char *memstream_gets(memstream_t *stream, char *buffer, size_t len)
{
return NULL;
}
int memstream_getc(memstream_t *stream)
{
int ret = 0;
if (stream->ptr >= stream->size)
return EOF;
ret = stream->buf[stream->ptr++];
if (stream->ptr > stream->max_ptr)
stream->max_ptr = stream->ptr;
return ret;
}
void memstream_putc(memstream_t *stream, int c)
{
if (stream->ptr < stream->size)
stream->buf[stream->ptr++] = c;
if (stream->ptr > stream->max_ptr)
stream->max_ptr = stream->ptr;
}
+711 -157
View File
File diff suppressed because it is too large Load Diff
+10 -2
View File
@@ -36,8 +36,7 @@
extern cothread_t mainThread;
extern cothread_t emuThread;
extern char Key_Sate[512];
extern char Key_Sate2[512];
extern char Key_State[512];
extern int pauseg;
@@ -76,4 +75,13 @@ extern int pauseg;
#endif
#define uint32 unsigned int
#define uint8 unsigned char
//Paddle & 5200 POT
#define LIBRETRO_ANALOG_RANGE 0x8000
#define JOY_5200_MIN 6
#define JOY_5200_MAX 220
#define JOY_5200_CENTER 114
void retro_message(const char* text, unsigned int frames, int alt);
void retro_audio_cb(short l, short r);
#endif
+736
View File
@@ -0,0 +1,736 @@
#ifndef LIBRETRO_CORE_OPTIONS_H__
#define LIBRETRO_CORE_OPTIONS_H__
#include <stdlib.h>
#include <string.h>
#include <libretro.h>
#include <retro_inline.h>
#ifndef HAVE_NO_LANGEXTRA
#include "libretro_core_options_intl.h"
#endif
/*
********************************
* VERSION: 1.0
********************************
*
* - 1.0: First commit. Support for cor options v2 interfaec.
* - libretro_core_options_intl.h includes BOM and utf-8
* fix for MSVC 2010-2013
* - Contains HAVE_NO_LANGEXTRA flag to disable translations
* on platforms/compilers without BOM support
* - Uses core options v1 interface when
* RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION is >= 1
* (previously required RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION == 1)
* - Support for generation of core options v0 retro_core_option_value
* arrays containing options with a single value
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
********************************
* Core Option Definitions
********************************
*/
/* RETRO_LANGUAGE_ENGLISH */
/* Default language:
* - All other languages must include the same keys and values
* - Will be used as a fallback in the event that frontend language
* is not available
* - Will be used as a fallback for any missing entries in
* frontend language definition */
//struct retro_core_option_v2_category option_cats_us[] = {
// { NULL, NULL, NULL },
//};
struct retro_core_option_v2_category option_cats_us[] = {
{
"video",
"Video",
"Configure video standard (NTSC/PAL). Enable Hi-res artifacting and set artifacting mode. Set internal resolution"
},
{
"input",
"Input",
"Configure 5200 Digital and Analog Joystick sensitivity and Analog deadzone. Activate Swap or Dual Joysticks. Activate Paddle mode and set Paddle speed. Set retroarch keyboard type."
},
{ NULL, NULL, NULL },
};
struct retro_core_option_v2_definition option_defs_us[] = {
{
"atari800_ntscpal",
"Video Standard",
NULL,
"Select whether emulated system is NTSC (60hz) or PAL (50hz)",
NULL,
"video",
{
{ "NTSC", NULL },
{ "PAL", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"atari800_artifacting_mode",
"Hi-Res Artifacting Mode",
NULL,
"Set Hi-Res Artifacting mode used. Typically dependant on the actual emulated system. Pick the color combination that pleases you.",
NULL,
"video",
{
{ "none", "None "},
{ "blue/brown 1", NULL },
{ "blue/brown 2", NULL },
{ "GTIA", NULL },
{ "CTIA", NULL },
{ NULL, NULL },
},
"none"
},
{
"atari800_resolution",
"Internal resolution",
NULL,
"Set emulated systems internal resolution.",
NULL,
"video",
{
{ "336x240", NULL },
{ "320x240", NULL },
{ "384x240", NULL },
{ "384x272", NULL },
{ "384x288", NULL },
{ "400x300", NULL },
{ NULL, NULL },
},
"336x240"
},
{
"atari800_opt2",
"Controller Hacks",
NULL,
"Apply gamepad input hacks required for specific games. 'Dual Stick' maps Player 2's joystick to the right analog stick of Player 1's RetroPad, enabling dual stick control in 'Robotron 2084' and 'Space Dungeon'. 'Swap Ports' maps Player 1 to port 2 and Player 2 to port 1 of the emulated console, correcting the swapped inputs of 'Wizard of Wor', 'Apple Panic' and a few other games",
NULL,
"input",
{
{ "none", NULL },
{ "enabled", "Dual Stick" },
{ "Swap Ports", "Swap Ports" },
{ NULL, NULL },
},
"none"
},
{
"paddle_active",
"Activate Paddle Mode",
NULL,
"Use analog stick and digital pad to control paddle games. Dual Stick and Swap Ports will be de-activated if this is enabled",
NULL,
"input",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"paddle_movement_speed",
"Paddle Movement Speed",
NULL,
"Determines how fast the paddle will move.",
NULL,
"input",
{
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ NULL, NULL },
},
"3"
},
{
"pot_digital_sensitivity",
"Digital Joystick Sensitivity",
NULL,
"Set the effective range of the emulated analog joystick when using the gamepad's digital D-Pad for movement. Lower values equate to slower speeds. Also can be used to make games like Centipede, Kaboom, Missile Command, Pengo, Realsports Tennis, Pole Position, Xari Arena and Super Breakout more playable.",
NULL,
"input",
{
{ "5", "5%" },
{ "10", "10%" },
{ "15", "15%" },
{ "20", "20%" },
{ "25", "25%" },
{ "30", "30%" },
{ "35", "35%" },
{ "40", "40%" },
{ "45", "45%" },
{ "50", "50%" },
{ "55", "55%" },
{ "60", "60%" },
{ "65", "65%" },
{ "70", "70%" },
{ "75", "75%" },
{ "80", "80%" },
{ "85", "85%" },
{ "90", "90%" },
{ "95", "95%" },
{ "100", "100%" },
{ NULL, NULL },
},
"100"
},
{
"pot_analog_sensitivity",
"Analog Joystick Sensitivity",
NULL,
"Set the effective range of the emulated analog joystick when using the gamepad's left analog stick for movement. Lower values equate to slower speeds. Also can be used to make games like Centipede, Kaboom, Missile Command, Pengo, Realsports Tennis, Pole Position, Xari Arena and Super Breakout more playable.",
NULL,
"input",
{
{ "5", "5%" },
{ "10", "10%" },
{ "15", "15%" },
{ "20", "20%" },
{ "25", "25%" },
{ "30", "30%" },
{ "35", "35%" },
{ "40", "40%" },
{ "45", "45%" },
{ "50", "50%" },
{ "55", "55%" },
{ "60", "60%" },
{ "65", "65%" },
{ "70", "70%" },
{ "75", "75%" },
{ "80", "80%" },
{ "85", "85%" },
{ "90", "90%" },
{ "95", "95%" },
{ "100", "100%" },
{ NULL, NULL },
},
"100"
},
{
"pot_analog_deadzone",
"Analog Joystick Deadzone",
NULL,
"Set the deadzone of the gamepad's analog sticks. Use this to eliminate controller drift.",
NULL,
"input",
{
{ "0", "0%" },
{ "3", "3%" },
{ "5", "5%" },
{ "7", "7%" },
{ "10", "10%" },
{ "13", "13%" },
{ "15", "15%" },
{ "17", "17%" },
{ "20", "20%" },
{ "23", "23%" },
{ "25", "25%" },
{ "27", "27%" },
{ "30", "30%" },
{ NULL, NULL },
},
"15"
},
{
"atari800_keyboard",
"Retroarch Keyboard type",
NULL,
"Set whether keyboard is polled or used callback.",
NULL,
"input",
{
{ "poll", NULL },
{ "callback", NULL },
{ NULL, NULL },
},
"poll"
},
{
"keyboard_defines",
"Atari Keyboard Defines",
NULL,
"Joystick and Console Key mappings for\n\"Atari Keyboard\".\n \n Joystick \"Keyboard Numpad 8, 2, 4 & 6\".\n \n5200 analog joystick. Left analog stick or \"Keyboard Numpad 8, 2, 4 & 6\".\n \nFire 1 \"Right CTRL\". Fire 2 \"Right ALT\".\n \n5200 * \"Keyboard Numpad * \". # \"Keyboard =\"\n \n5200 Keypad 0-9 \"Keyboard 0-9\".\nPause \"P\", Reset \"R\".\n \n'Console' keys Option \"F2\", Select \"F3\",\nStart \"F4\".\n \nController 1 only.",
NULL,
"input",
{
{ "informational", NULL },
{ NULL, NULL },
},
"informational"
},
{
"atari800_system",
"Atari System",
NULL,
"Select system emulated. Atari 5200 for Atari 5200 console games. 400/800 (OS B) for <48K games or ones that require OS/B. 800XL (64K) works for most content. 130XE (128K), Modern XL/XE(320K Compy Shop), Modern XL/XE(576K), Modern XL/XE(1088K) for content that needs more than 64K.",
NULL,
NULL,
{
{ "400/800 (OS B)", "Atari 400/800 (OS B)" },
{ "800XL (64K)", "Atari 800XL (64K)" },
{ "130XE (128K)", "Atari 130XE (128K)" },
{ "Modern XL/XE(320K CS)", "Modern Atari XL/XE(320K Compy Shop)" },
{ "Modern XL/XE(576K)", "Modern Atari XL/XE(576K)" },
{ "Modern XL/XE(1088K)", "Modern Atari XL/XE(1088K)" },
{ "5200", "Atari 5200 Super System" },
{ NULL, NULL },
},
"400/800 (OS B)"
},
{
"atari800_internalbasic",
"Internal BASIC (hold OPTION on boot) (Restart)",
NULL,
"Enable for content that needs Atari BASIC in order to run. A proper ROM file (ATARIBAS.ROM) is needed.",
NULL,
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"atari800_sioaccel",
"SIO Acceleration",
NULL,
"This enables ALL SIO acceleration. Enabled improves loading speed for Disk and Cassette images. Disable only for protected disk (.ATX) and protected cassette images. Reboot required if change made while loading a cassette image.",
NULL,
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"enabled"
},
{
"atari800_cassboot",
"Boot from Cassette (Reboot)",
NULL,
"Forces emulated system to boot from autoboot cassette images by holding down the \"START\" key on boot.",
NULL,
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"atari800_opt1",
"Autodetect Atari Cartridge Type (Restart)",
NULL,
"Emulator will auto detect Atari cartridge based on checksum. (requires good ROM dumps).",
NULL,
NULL,
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
/* Not sure if I want to implement this. Only helps a small handful of games ( Kaboom, Super Breakout and Star Wars The Arcade Game
{
"pot_analog_center",
"Analog Joystick/Paddle Center",
NULL,
"Set the value for emulated analog joystick or paddle center. Use this to properly center player for some games like Kaboom, Starwars or Super Breakout. Default is 114",
NULL,
"5200",
{
{ "80", NULL },
{ "82", NULL },
{ "84", NULL },
{ "86", NULL },
{ "88", NULL },
{ "90", NULL },
{ "92", NULL },
{ "94", NULL },
{ "96", NULL },
{ "98", NULL },
{ "100", NULL },
{ "102", NULL },
{ "104", NULL },
{ "106", NULL },
{ "108", NULL },
{ "110", NULL },
{ "112", NULL },
{ "114", NULL },
{ "116", NULL },
{ "118", NULL },
{ "120", NULL },
{ "122", NULL },
{ "124", NULL },
{ "126", NULL },
{ "128", NULL },
{ "130", NULL },
{ "132", NULL },
{ "134", NULL },
{ "136", NULL },
{ "130", NULL },
{ "140", NULL },
{ "142", NULL },
{ "144", NULL },
{ "146", NULL },
{ "148", NULL },
{ "150", NULL },
{ NULL, NULL },
},
"114"
}, */
{ NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
};
struct retro_core_options_v2 options_us = {
option_cats_us,
option_defs_us
};
/*
********************************
* Language Mapping
********************************
*/
#ifndef HAVE_NO_LANGEXTRA
struct retro_core_options_v2 *options_intl[RETRO_LANGUAGE_LAST] = {
&options_us, /* RETRO_LANGUAGE_ENGLISH */
NULL, /* RETRO_LANGUAGE_JAPANESE */
NULL, /* RETRO_LANGUAGE_FRENCH */
NULL, /* RETRO_LANGUAGE_SPANISH */
NULL, /* RETRO_LANGUAGE_GERMAN */
NULL, /* RETRO_LANGUAGE_ITALIAN */
NULL, /* RETRO_LANGUAGE_DUTCH */
NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
NULL, /* RETRO_LANGUAGE_RUSSIAN */
NULL, /* RETRO_LANGUAGE_KOREAN */
NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
NULL, /* RETRO_LANGUAGE_ESPERANTO */
NULL, /* RETRO_LANGUAGE_POLISH */
NULL, /* RETRO_LANGUAGE_VIETNAMESE */
NULL, /* RETRO_LANGUAGE_ARABIC */
NULL, /* RETRO_LANGUAGE_GREEK */
NULL, /* RETRO_LANGUAGE_TURKISH */
NULL, /* RETRO_LANGUAGE_SLOVAK */
NULL, /* RETRO_LANGUAGE_PERSIAN */
NULL, /* RETRO_LANGUAGE_HEBREW */
NULL, /* RETRO_LANGUAGE_ASTURIAN */
NULL, /* RETRO_LANGUAGE_FINNISH */
};
#endif
/*
********************************
* Functions
********************************
*/
/* Handles configuration/setting of core options.
* Should be called as early as possible - ideally inside
* retro_set_environment(), and no later than retro_load_game()
* > We place the function body in the header to avoid the
* necessity of adding more .c files (i.e. want this to
* be as painless as possible for core devs)
*/
static INLINE void libretro_set_core_options(retro_environment_t environ_cb,
bool *categories_supported)
{
unsigned version = 0;
#ifndef HAVE_NO_LANGEXTRA
unsigned language = 0;
#endif
if (!environ_cb || !categories_supported)
return;
*categories_supported = false;
if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version))
version = 0;
if (version >= 2)
{
#ifndef HAVE_NO_LANGEXTRA
struct retro_core_options_v2_intl core_options_intl;
core_options_intl.us = &options_us;
core_options_intl.local = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
(language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
core_options_intl.local = options_intl[language];
*categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL,
&core_options_intl);
#else
*categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
&options_us);
#endif
}
else
{
size_t i, j;
size_t option_index = 0;
size_t num_options = 0;
struct retro_core_option_definition
*option_v1_defs_us = NULL;
#ifndef HAVE_NO_LANGEXTRA
size_t num_options_intl = 0;
struct retro_core_option_v2_definition
*option_defs_intl = NULL;
struct retro_core_option_definition
*option_v1_defs_intl = NULL;
struct retro_core_options_intl
core_options_v1_intl;
#endif
struct retro_variable *variables = NULL;
char **values_buf = NULL;
/* Determine total number of options */
while (true)
{
if (option_defs_us[num_options].key)
num_options++;
else
break;
}
if (version >= 1)
{
/* Allocate US array */
option_v1_defs_us = (struct retro_core_option_definition *)
calloc(num_options + 1, sizeof(struct retro_core_option_definition));
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
{
struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i];
struct retro_core_option_value *option_values = option_def_us->values;
struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i];
struct retro_core_option_value *option_v1_values = option_v1_def_us->values;
option_v1_def_us->key = option_def_us->key;
option_v1_def_us->desc = option_def_us->desc;
option_v1_def_us->info = option_def_us->info;
option_v1_def_us->default_value = option_def_us->default_value;
/* Values must be copied individually... */
while (option_values->value)
{
option_v1_values->value = option_values->value;
option_v1_values->label = option_values->label;
option_values++;
option_v1_values++;
}
}
#ifndef HAVE_NO_LANGEXTRA
if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
(language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) &&
options_intl[language])
option_defs_intl = options_intl[language]->definitions;
if (option_defs_intl)
{
/* Determine number of intl options */
while (true)
{
if (option_defs_intl[num_options_intl].key)
num_options_intl++;
else
break;
}
/* Allocate intl array */
option_v1_defs_intl = (struct retro_core_option_definition *)
calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition));
/* Copy parameters from option_defs_intl array */
for (i = 0; i < num_options_intl; i++)
{
struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i];
struct retro_core_option_value *option_values = option_def_intl->values;
struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i];
struct retro_core_option_value *option_v1_values = option_v1_def_intl->values;
option_v1_def_intl->key = option_def_intl->key;
option_v1_def_intl->desc = option_def_intl->desc;
option_v1_def_intl->info = option_def_intl->info;
option_v1_def_intl->default_value = option_def_intl->default_value;
/* Values must be copied individually... */
while (option_values->value)
{
option_v1_values->value = option_values->value;
option_v1_values->label = option_values->label;
option_values++;
option_v1_values++;
}
}
}
core_options_v1_intl.us = option_v1_defs_us;
core_options_v1_intl.local = option_v1_defs_intl;
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl);
#else
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us);
#endif
}
else
{
/* Allocate arrays */
variables = (struct retro_variable *)calloc(num_options + 1,
sizeof(struct retro_variable));
values_buf = (char **)calloc(num_options, sizeof(char *));
if (!variables || !values_buf)
goto error;
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
{
const char *key = option_defs_us[i].key;
const char *desc = option_defs_us[i].desc;
const char *default_value = option_defs_us[i].default_value;
struct retro_core_option_value *values = option_defs_us[i].values;
size_t buf_len = 3;
size_t default_index = 0;
values_buf[i] = NULL;
if (desc)
{
size_t num_values = 0;
/* Determine number of values */
while (true)
{
if (values[num_values].value)
{
/* Check if this is the default value */
if (default_value)
if (strcmp(values[num_values].value, default_value) == 0)
default_index = num_values;
buf_len += strlen(values[num_values].value);
num_values++;
}
else
break;
}
/* Build values string */
if (num_values > 0)
{
buf_len += num_values - 1;
buf_len += strlen(desc);
values_buf[i] = (char *)calloc(buf_len, sizeof(char));
if (!values_buf[i])
goto error;
strcpy(values_buf[i], desc);
strcat(values_buf[i], "; ");
/* Default value goes first */
strcat(values_buf[i], values[default_index].value);
/* Add remaining values */
for (j = 0; j < num_values; j++)
{
if (j != default_index)
{
strcat(values_buf[i], "|");
strcat(values_buf[i], values[j].value);
}
}
}
}
variables[option_index].key = key;
variables[option_index].value = values_buf[i];
option_index++;
}
/* Set variables */
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
}
error:
/* Clean up */
if (option_v1_defs_us)
{
free(option_v1_defs_us);
option_v1_defs_us = NULL;
}
#ifndef HAVE_NO_LANGEXTRA
if (option_v1_defs_intl)
{
free(option_v1_defs_intl);
option_v1_defs_intl = NULL;
}
#endif
if (values_buf)
{
for (i = 0; i < num_options; i++)
{
if (values_buf[i])
{
free(values_buf[i]);
values_buf[i] = NULL;
}
}
free(values_buf);
values_buf = NULL;
}
if (variables)
{
free(variables);
variables = NULL;
}
}
}
#ifdef __cplusplus
}
#endif
#endif
+91
View File
@@ -0,0 +1,91 @@
#ifndef LIBRETRO_CORE_OPTIONS_INTL_H__
#define LIBRETRO_CORE_OPTIONS_INTL_H__
#if defined(_MSC_VER) && (_MSC_VER >= 1500 && _MSC_VER < 1900)
/* https://support.microsoft.com/en-us/kb/980263 */
#pragma execution_character_set("utf-8")
#pragma warning(disable:4566)
#endif
#include <libretro.h>
/*
********************************
* VERSION: 2.0
********************************
*
* - 2.0: Add support for core options v2 interface
* - 1.3: Move translations to libretro_core_options_intl.h
* - libretro_core_options_intl.h includes BOM and utf-8
* fix for MSVC 2010-2013
* - Added HAVE_NO_LANGEXTRA flag to disable translations
* on platforms/compilers without BOM support
* - 1.2: Use core options v1 interface when
* RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION is >= 1
* (previously required RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION == 1)
* - 1.1: Support generation of core options v0 retro_core_option_value
* arrays containing options with a single value
* - 1.0: First commit
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
********************************
* Core Option Definitions
********************************
*/
/* RETRO_LANGUAGE_JAPANESE */
/* RETRO_LANGUAGE_FRENCH */
/* RETRO_LANGUAGE_SPANISH */
/* RETRO_LANGUAGE_GERMAN */
/* RETRO_LANGUAGE_ITALIAN */
/* RETRO_LANGUAGE_DUTCH */
/* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
/* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
/* RETRO_LANGUAGE_RUSSIAN */
/* RETRO_LANGUAGE_KOREAN */
/* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
/* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
/* RETRO_LANGUAGE_ESPERANTO */
/* RETRO_LANGUAGE_POLISH */
/* RETRO_LANGUAGE_VIETNAMESE */
/* RETRO_LANGUAGE_ARABIC */
/* RETRO_LANGUAGE_GREEK */
/* RETRO_LANGUAGE_TURKISH */
/* RETRO_LANGUAGE_SLOVAK */
/* RETRO_LANGUAGE_PERSIAN */
/* RETRO_LANGUAGE_HEBREW */
/* RETRO_LANGUAGE_ASTURIAN */
/* RETRO_LANGUAGE_FINNISH */
#ifdef __cplusplus
}
#endif
#endif
+461 -333
View File
File diff suppressed because it is too large Load Diff
+428
View File
@@ -0,0 +1,428 @@
/* Copyright (C) 2018
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdarg.h>
#include "libretro.h"
#include "retro_disk_control.h"
#include "retro_strings.h"
#include "retro_utils.h"
#include "file/file_path.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string/stdstring.h>
/*#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>*/
static void fallback_log(enum retro_log_level level, const char* fmt, ...);
static retro_log_printf_t log_cb = fallback_log;
static void fallback_log(enum retro_log_level level, const char* fmt, ...)
{
va_list va;
(void)level;
va_start(va, fmt);
vfprintf(stderr, fmt, va);
va_end(va);
}
#define COMMENT "#"
#define M3U_SPECIAL_COMMAND "#COMMAND:"
// Return the directory name of filename 'filename'.
static char* dirname_int(const char* filename)
{
if (filename == NULL)
return NULL;
// Find last separator
char* right = find_last_slash(filename);
if (right)
return strleft(filename, right - filename);
// Not found
return NULL;
}
static char* m3u_search_file(const char* basedir, const char* dskName)
{
// If basedir was provided
if (basedir != NULL && !path_is_absolute(dskName))
{
// Join basedir and dskName
char* dskPath = path_join_dup(basedir, dskName);
// Verify if this item is a relative filename (append it to the m3u path)
if (file_exists(dskPath))
{
// Return
return dskPath;
}
free(dskPath);
}
// Verify if this item is an absolute pathname (or the file is in working dir)
if (file_exists(dskName))
{
// Copy and return
return strdup(dskName);
}
// File not found
return NULL;
}
void dc_reset(dc_storage* dc)
{
unsigned i;
// Verify
if (dc == NULL)
return;
// Clean the command
if (dc->command)
{
free(dc->command);
dc->command = NULL;
}
// Clean the struct
for (i = 0; i < dc->count; i++)
{
free(dc->files[i]);
dc->files[i] = NULL;
free(dc->names[i]);
dc->names[i] = NULL;
dc->types[i] = DC_IMAGE_TYPE_NONE;
}
dc->unit = DC_IMAGE_TYPE_NONE;
dc->count = 0;
dc->index = 0;
dc->index_prev = 0;
dc->eject_state = true;
dc->replace = false;
}
dc_storage* dc_create(void)
{
int i;
// Initialize the struct
dc_storage* dc = NULL;
if ((dc = (dc_storage*)malloc(sizeof(dc_storage))) != NULL)
{
dc->unit = DC_IMAGE_TYPE_NONE;
dc->count = 0;
dc->index = 0;
dc->eject_state = true;
dc->replace = false;
dc->command = NULL;
for (i = 0; i < DC_MAX_SIZE; i++)
{
dc->files[i] = NULL;
dc->names[i] = NULL;
dc->types[i] = DC_IMAGE_TYPE_NONE;
}
}
return dc;
}
bool dc_add_file_int(dc_storage* dc, char* filename, char* name)
{
/* Verify */
if (dc == NULL)
return false;
if (!filename || (*filename == '\0'))
return false;
/* If max size is not exceeded */
if (dc->count < DC_MAX_SIZE)
{
/* Add the file */
dc->count++;
dc->files[dc->count - 1] = strdup(filename);
dc->names[dc->count - 1] = !string_is_empty(name) ? strdup(name) : NULL;
dc->types[dc->count - 1] = dc_get_image_type(filename);
log_cb(RETRO_LOG_INFO, ">>> dc added int %s - [%s]\n", filename, name);
return true;
}
return false;
}
bool dc_add_file(dc_storage* dc, const char* filename)
{
unsigned index = 0;
/* Verify */
if (dc == NULL || !filename || (*filename == '\0'))
return false;
/* Dupecheck */
for (index = 0; index < dc->count; index++)
{
if (!strcmp(dc->files[index], filename))
{
log_cb(RETRO_LOG_INFO,"File '%s' ignored as duplicate!\n", filename);
return true;
}
}
// Get 'name' - just the filename without extension
char name[512];
name[0] = '\0';
fill_pathname(name, path_basename(filename), "", sizeof(name));
if (!dc_add_file_int(dc, strdup(filename), strdup(name)))
return false;
// if dc unit-type is none, get type from first image
if (dc->unit == DC_IMAGE_TYPE_NONE)
{
if (dc_get_image_type(dc->files[0]) == DC_IMAGE_TYPE_TAPE)
dc->unit = DC_IMAGE_TYPE_TAPE;
else if (dc_get_image_type(dc->files[0]) == DC_IMAGE_TYPE_FLOPPY)
dc->unit = DC_IMAGE_TYPE_FLOPPY;
else if (dc_get_image_type(dc->files[0]) == DC_IMAGE_TYPE_MEM)
dc->unit = DC_IMAGE_TYPE_MEM;
else
dc->unit = DC_IMAGE_TYPE_FLOPPY;
}
log_cb(RETRO_LOG_INFO,">>> dc added %s - [%s] [unit %i]\n", filename, name, dc->unit);
return true;
}
bool dc_remove_file(dc_storage* dc, int index)
{
if (dc == NULL)
return false;
if (index < 0 || index >= dc->count)
return false;
// "If ptr is a null pointer, no action occurs"
free(dc->files[index]);
dc->files[index] = NULL;
free(dc->names[index]);
dc->names[index] = NULL;
dc->types[index] = DC_IMAGE_TYPE_NONE;
// Shift all entries after index one slot up
if (index != dc->count - 1)
{
memmove(dc->files + index, dc->files + index + 1, (dc->count - 1 - index) * sizeof(dc->files[0]));
memmove(dc->names + index, dc->names + index + 1, (dc->count - 1 - index) * sizeof(dc->names[0]));
}
dc->count--;
// Reset fliplist unit after removing last entry
if (dc->count == 0)
{
dc->unit = DC_IMAGE_TYPE_NONE;
}
return true;
}
int dc_replace_file(dc_storage* dc, int index, const char* filename)
{
if (dc == NULL)
return false;
if (index < 0 || index >= dc->count)
return false;
// "If ptr is a null pointer, no action occurs"
free(dc->files[index]);
dc->files[index] = NULL;
free(dc->names[index]);
dc->names[index] = NULL;
dc->types[index] = DC_IMAGE_TYPE_NONE;
if (filename == NULL)
{
dc_remove_file(dc, index);
}
else
{
dc->replace = false;
char full_path_replace[RETRO_PATH_MAX] = { 0 };
strncpy(full_path_replace, (char*)filename, sizeof(full_path_replace));
/* ZIP/M3U not implemented internally */
if (
strendswith(full_path_replace, "m3u") ||
strendswith(full_path_replace, "zip") ||
strendswith(full_path_replace, "7z")
)
{
log_cb(RETRO_LOG_INFO,">>> dc replace %s unsupported type.\n", filename);
return false;
}
/* Single append */
else
{
// Get 'name' - just the filename without extension
char name[512];
name[0] = '\0';
fill_pathname(name, path_basename(filename), "", sizeof(name));
/* Dupecheck */
for (unsigned i = 0; i < dc->count - 1; i++)
{
if (!strcmp(dc->files[i], full_path_replace))
{
dc_remove_file(dc, index);
return 2; // 2 = duplicate found
}
}
dc->files[index] = strdup(filename);
dc->names[index] = !string_is_empty(name) ? strdup(name) : NULL;
dc->types[index] = dc_get_image_type(filename);
log_cb(RETRO_LOG_INFO,">>> dc replace %s - %s [%u].\n", filename, name , dc->types[index] );
}
}
return true;
}
void dc_parse_m3u(dc_storage* dc, const char* m3u_file)
{
// Verify
if (dc == NULL)
return;
if (m3u_file == NULL)
return;
FILE* fp = NULL;
// Try to open the file
if ((fp = fopen(m3u_file, "r")) == NULL)
return;
// Reset
dc_reset(dc);
// Get the m3u base dir for resolving relative path
char* basedir = dirname_int(m3u_file);
// Disk control interface 'name' for the following file
char* image_name = NULL;
// Read the lines while there is line to read and we have enough space
char buffer[2048];
while ((dc->count <= DC_MAX_SIZE) && (fgets(buffer, sizeof(buffer), fp) != NULL))
{
char* string = trimwhitespace(buffer);
// If it's a m3u special key or a file
if (strstartswith(string, M3U_SPECIAL_COMMAND))
{
dc->command = strright(string, strlen(string) - strlen(M3U_SPECIAL_COMMAND));
}
else if (!strstartswith(string, COMMENT))
{
// Search the file (absolute, relative to m3u)
char* filename;
if ((filename = m3u_search_file(basedir, string)) != NULL)
{
char tmp[512];
tmp[0] = '\0';
fill_pathname(tmp, path_basename(filename), "", sizeof(tmp));
image_name = strdup(tmp);
// Add the file to the struct
dc_add_file_int(dc, filename, image_name);
image_name = NULL;
}
}
}
// If basedir was provided
if (basedir != NULL)
free(basedir);
// Close the file
fclose(fp);
if (dc->count != 0)
{
if (dc_get_image_type(dc->files[0]) == DC_IMAGE_TYPE_TAPE)
dc->unit = DC_IMAGE_TYPE_TAPE;
else if (dc_get_image_type(dc->files[0]) == DC_IMAGE_TYPE_FLOPPY)
dc->unit = DC_IMAGE_TYPE_FLOPPY;
else
dc->unit = DC_IMAGE_TYPE_FLOPPY;
log_cb(RETRO_LOG_INFO,">>> dc (m3u) unit type: %i\n", dc->unit);
}
}
void dc_free(dc_storage* dc)
{
// Clean the struct
dc_reset(dc);
free(dc);
dc = NULL;
return;
}
enum dc_image_type dc_get_image_type(const char* filename)
{
// Missing file
if (!filename || (*filename == '\0'))
return DC_IMAGE_TYPE_NONE;
// Floppy image
if (strendswith(filename, "atr") ||
strendswith(filename, "atx") ||
strendswith(filename, "xfd") ||
strendswith(filename, "dcm"))
return DC_IMAGE_TYPE_FLOPPY;
// Tape image. Removed "cdt" since it is not an Atari800 file type
if (strendswith(filename, "cas"))
return DC_IMAGE_TYPE_TAPE;
// Fallback
return DC_IMAGE_TYPE_UNKNOWN;
}
+86
View File
@@ -0,0 +1,86 @@
/****************************************************************************
* Caprice32 libretro port
*
* Copyright not6 - r-type (2015-2018)
* Copyright David Colmenero - D_Skywalk (2019-2021)
* Copyright Daniel De Matteis (2012-2021)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************************/
#ifndef RETRO_DISK_CONTROL_H__
#define RETRO_DISK_CONTROL_H__
#include <stdbool.h>
//*****************************************************************************
// Disk control structure and functions
#define DC_MAX_SIZE 20
//static INLINE bool string_is_empty(const char* data)
//{
// return !data || (*data == '\0');
//}
enum dc_image_type {
DC_IMAGE_TYPE_NONE = 0,
DC_IMAGE_TYPE_FLOPPY,
DC_IMAGE_TYPE_TAPE,
DC_IMAGE_TYPE_MEM,
DC_IMAGE_TYPE_UNKNOWN
};
struct dc_storage{
char* command;
char* files[DC_MAX_SIZE];
char* names[DC_MAX_SIZE];
enum dc_image_type types[DC_MAX_SIZE];
unsigned unit;
unsigned count;
int index;
bool eject_state;
bool replace;
unsigned index_prev;
};
typedef struct dc_storage dc_storage;
dc_storage* dc_create(void);
void dc_parse_m3u(dc_storage* dc, const char* m3u_file);
bool dc_add_file(dc_storage* dc, const char* filename);
void dc_free(dc_storage* dc);
void dc_reset(dc_storage* dc);
int dc_replace_file(dc_storage* dc, int index, const char* filename);
bool dc_remove_file(dc_storage* dc, int index);
enum dc_image_type dc_get_image_type(const char* filename);
#endif
+28
View File
@@ -0,0 +1,28 @@
/* Copyright (C) 2018
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "retro_files.h"
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
void path_join(char* out, const char* basedir, const char* filename)
{
snprintf(out, RETRO_PATH_MAX, "%s%s%s", basedir, RETRO_PATH_SEPARATOR, filename);
}
+38
View File
@@ -0,0 +1,38 @@
/* Copyright (C) 2018
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef RETRO_FILES_H__
#define RETRO_FILES_H__
#include <stdbool.h>
//*****************************************************************************
// File helpers functions
#define RETRO_PATH_MAX 512
#ifdef _WIN32
#define RETRO_PATH_SEPARATOR "\\"
// Windows also support the unix path separator
#define RETRO_PATH_SEPARATOR_ALT "/"
#else
#define RETRO_PATH_SEPARATOR "/"
#endif
void path_join(char* out, const char* basedir, const char* filename);
#endif
+86
View File
@@ -0,0 +1,86 @@
/* Copyright (C) 2018
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "retro_strings.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Note: This function returns a pointer to a substring_left of the original string.
// If the given string was allocated dynamically, the caller must not overwrite
// that pointer with the returned value, since the original pointer must be
// deallocated using the same allocator with which it was allocated. The return
// value must NOT be deallocated using free() etc.
char* trimwhitespace(char *str)
{
char *end;
// Trim leading space
while(isspace((unsigned char)*str)) str++;
if(*str == 0) // All spaces?
return str;
// Trim trailing space
end = str + strlen(str) - 1;
while(end > str && isspace((unsigned char)*end)) end--;
// Write new null terminator character
end[1] = '\0';
return str;
}
// Returns a substring of 'str' that contains the 'len' leftmost characters of 'str'.
char* strleft(const char* str, int len)
{
char* result = calloc(len + 1, sizeof(char));
strncpy(result, str, len);
return result;
}
// Returns a substring of 'str' that contains the 'len' rightmost characters of 'str'.
char* strright(const char* str, int len)
{
int pos = strlen(str) - len;
char* result = calloc(len + 1, sizeof(char));
strncpy(result, str + pos, len);
return result;
}
// Returns true if 'str' starts with 'start'
bool strstartswith(const char* str, const char* start)
{
if (strlen(str) >= strlen(start))
if(!strncasecmp(str, start, strlen(start)))
return true;
return false;
}
// Returns true if 'str' ends with 'end'
bool strendswith(const char* str, const char* end)
{
if (strlen(str) >= strlen(end))
if(!strcasecmp((char*)&str[strlen(str)-strlen(end)], end))
return true;
return false;
}
+32
View File
@@ -0,0 +1,32 @@
/* Copyright (C) 2018
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef RETRO_STRINGS_H__
#define RETRO_STRINGS_H__
#include <stdbool.h>
//*****************************************************************************
// String helpers functions
char* trimwhitespace(char *str);
char* strleft(const char* str, int len);
char* strright(const char* str, int len);
bool strstartswith(const char* str, const char* start);
bool strendswith(const char* str, const char* end);
#endif
+185
View File
@@ -0,0 +1,185 @@
/****************************************************************************
* Caprice32 libretro port
*
* Copyright not6 - r-type (2015-2018)
* Copyright David Colmenero - D_Skywalk (2019-2021)
* Copyright Daniel De Matteis (2012-2021)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************************/
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "retro_utils.h"
#ifdef VITA
#include "file/file_path.h"
#endif
extern uint8_t* pbGPBuffer;
// Verify file extension
bool file_check_extension(const char *filename, const size_t filename_size, const char *ext, const size_t ext_size)
{
#ifndef __PS3__
size_t file_len = strnlen(filename, filename_size);
size_t ext_len = strnlen(ext, ext_size);
#else
size_t file_len = strlen(filename) > filename_size ? filename_size : strlen(filename);
size_t ext_len = strlen(ext) > ext_size ? ext_size : strlen(ext);
#endif
if( ext_len > file_len || file_len >= filename_size - 1)
return false;
const char * file_ext = &filename[file_len - ext_len];
return (strncasecmp(file_ext, ext, filename_size) == 0);
}
bool file_check_flag(const char *filename, const size_t filename_size, const char *flag, const size_t flag_size)
{
#ifndef __PS3__
size_t file_len = strnlen(filename, filename_size);
size_t flag_len = strnlen(flag, flag_size);
#else
size_t file_len = strlen(filename) > filename_size ? filename_size : strlen(filename);
size_t flag_len = strlen(flag) > flag_size ? flag_size : strlen(flag);
#endif
for (int i = 0; i < file_len; i++) {
if (i + flag_len > file_len)
return false;
if (strncasecmp(&filename[i], flag, flag_len) == 0)
return true;
}
return false;
}
// Verify if file exists
bool file_exists(const char *filename)
{
#ifdef VITA
if (path_is_valid(filename) && !path_is_directory(filename))
#else
struct stat buf;
if (stat(filename, &buf) == 0 &&
(buf.st_mode & (S_IRUSR|S_IWUSR)) && !(buf.st_mode & S_IFDIR))
#endif
{
/* file points to user readable regular file */
return true;
}
return false;
}
int file_size (int file_num)
{
struct stat s;
if (!fstat(file_num, &s)) {
return s.st_size;
} else {
return 0;
}
}
void path_join(char* out, const char* basedir, const char* filename)
{
snprintf(out, RETRO_PATH_MAX, "%s%s%s", basedir, RETRO_PATH_SEPARATOR, filename);
}
char* path_join_dup(const char* basedir, const char* filename)
{
size_t dirlen = strlen(basedir);
size_t seplen = strlen(RETRO_PATH_SEPARATOR);
size_t filelen = strlen(filename);
char* result = (char*)malloc(dirlen + seplen + filelen + 1);
strcpy(result, basedir);
strcpy(result + dirlen, RETRO_PATH_SEPARATOR);
strcpy(result + dirlen + seplen, filename);
return result;
}
/**
* D_Skywalk: Imported from my 3DS pituka implementation
* http://david.dantoine.org/proyecto/26/
*/
#ifdef _3DS
void* linearMemAlign(size_t size, size_t alignment);
void linearFree(void* mem);
#endif
void *retro_malloc(size_t size) {
#ifdef _3DS
return linearMemAlign(size, 0x80);
#else
return malloc(size);
#endif
}
void retro_free(void * mem) {
#ifdef _3DS
linearFree(mem);
#else
free(mem);
#endif
}
// ----------------------------- crc32b --------------------------------
/* This is the basic CRC-32 calculation with some optimization but no
table lookup. The the byte reversal is avoided by shifting the crc reg
right instead of left and by using a reversed 32-bit word to represent
the polynomial. */
uint32_t crc32_calculate(uint8_t * data, uint32_t size) {
uint32_t byte, crc, mask;
crc = 0xFFFFFFFF;
for (int i = 0; i < size; i++) {
byte = data[i];
crc = crc ^ byte;
for (int j = 7; j >= 0; j--) {
mask = -(crc & 1);
crc = (crc >> 1) ^ (0xedb88320 & mask);
}
}
return ~crc;
}
+72
View File
@@ -0,0 +1,72 @@
/****************************************************************************
* Caprice32 libretro port
*
* Copyright not6 - r-type (2015-2018)
* Copyright David Colmenero - D_Skywalk (2019-2021)
* Copyright Daniel De Matteis (2012-2021)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************************/
#ifndef RETRO_UTILS_H__
#define RETRO_UTILS_H__
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
//*****************************************************************************
// File helpers functions
#define RETRO_PATH_MAX 512
#ifdef _WIN32
#define RETRO_PATH_SEPARATOR "\\"
// Windows also support the unix path separator
#define RETRO_PATH_SEPARATOR_ALT "/"
#else
#define RETRO_PATH_SEPARATOR "/"
#endif
bool file_check_extension(const char *filename, const size_t filename_size, const char *ext, const size_t ext_size);
bool file_check_flag(const char *filename, const size_t filename_size, const char *flag, const size_t flag_size);
void path_join(char* out, const char* basedir, const char* filename);
char* path_join_dup(const char* basedir, const char* filename);
bool file_exists(const char *filename);
int file_size (int file_num);
uint32_t get_hash(const char *filename);
void *retro_malloc(size_t size);
void retro_free(void * mem);
#endif