bsnes/icarus/core/core.hpp

172 lines
6.5 KiB
C++
Raw Normal View History

2015-08-21 11:29:53 +00:00
struct Icarus {
virtual auto create(const string& pathname) -> bool {
return directory::create(pathname);
}
virtual auto exists(const string& filename) -> bool {
return file::exists(filename);
}
virtual auto copy(const string& target, const string& source) -> bool {
return file::copy(target, source);
}
virtual auto write(const string& filename, const uint8_t* data, uint size) -> bool {
return file::write(filename, {data, size});
}
auto write(const string& filename, const vector<uint8_t>& buffer) -> bool {
return write(filename, buffer.data(), buffer.size());
}
auto write(const string& filename, const string& text) -> bool {
return write(filename, (const uint8_t*)text.data(), text.size());
}
2015-08-21 11:29:53 +00:00
//core.cpp
Icarus();
2015-08-21 11:29:53 +00:00
auto error() const -> string;
auto missing() const -> vector<string>;
Update to v096r06 release. byuu says: This WIP finally achieves the vision I've had for icarus. I also fixed a mapping issue with Cx4 that, oddly enough, only caused the "2" from the Mega Man X2 title screen to disappear. [Editor's note - "the vision for icarus" was described in a separate, public forum post: http://board.byuu.org/phpbb3/viewtopic.php?p=20584 Quoting for posterity: icarus is now a full-fledged part of higan, and will be bundled with each higan WIP as well. This will ensure that in the future, the exact version of icarus you need to run higan will be included right along with it. As of this WIP, physical manifest files are now truly and entirely optional. From now on, you can associate your ROM image files with higan's main binary, or drop them directly on top of it, to load and play your games. Furthermore, there are two new menu options that appear under the library menu when icarus is present: - "Load ROM File ..." => gives you a single-file selection dialog to import (and if possible) run the game - "Import ROM Files ..." => gives you a multi-file import dialog with checkboxes to pull in multiple games at once Finally, as before, icarus can generate manifest.bml files for folders that lack them. For people who like the game folder and library system, nothing's changed. Keep using higan as you have been. For people who hate it, you can now use higan like your classic emulators. Treat the "Library->{System Name}" entries as your "favorites" list: the games you actually play. Treat the "Library->Load ROM" as your standard open file dialog in other emulators. And finally, treat "Advanced->Game Library" as your save data path for cheat codes, save states, save RAM, etc. ]
2016-01-13 10:47:45 +00:00
auto success(string location) -> string;
auto failure(string message) -> string;
2015-08-21 11:29:53 +00:00
auto manifest(string location) -> string;
Update to v096r06 release. byuu says: This WIP finally achieves the vision I've had for icarus. I also fixed a mapping issue with Cx4 that, oddly enough, only caused the "2" from the Mega Man X2 title screen to disappear. [Editor's note - "the vision for icarus" was described in a separate, public forum post: http://board.byuu.org/phpbb3/viewtopic.php?p=20584 Quoting for posterity: icarus is now a full-fledged part of higan, and will be bundled with each higan WIP as well. This will ensure that in the future, the exact version of icarus you need to run higan will be included right along with it. As of this WIP, physical manifest files are now truly and entirely optional. From now on, you can associate your ROM image files with higan's main binary, or drop them directly on top of it, to load and play your games. Furthermore, there are two new menu options that appear under the library menu when icarus is present: - "Load ROM File ..." => gives you a single-file selection dialog to import (and if possible) run the game - "Import ROM Files ..." => gives you a multi-file import dialog with checkboxes to pull in multiple games at once Finally, as before, icarus can generate manifest.bml files for folders that lack them. For people who like the game folder and library system, nothing's changed. Keep using higan as you have been. For people who hate it, you can now use higan like your classic emulators. Treat the "Library->{System Name}" entries as your "favorites" list: the games you actually play. Treat the "Library->Load ROM" as your standard open file dialog in other emulators. And finally, treat "Advanced->Game Library" as your save data path for cheat codes, save states, save RAM, etc. ]
2016-01-13 10:47:45 +00:00
auto import(string location) -> string;
2015-08-21 11:29:53 +00:00
auto concatenate(vector<uint8_t>& output, string location) -> void;
2015-08-21 11:29:53 +00:00
//famicom.cpp
auto famicomManifest(string location) -> string;
auto famicomManifest(vector<uint8_t>& buffer, string location) -> string;
auto famicomImport(vector<uint8_t>& buffer, string location) -> string;
2015-08-21 11:29:53 +00:00
//super-famicom.cpp
auto superFamicomManifest(string location) -> string;
auto superFamicomManifest(vector<uint8_t>& buffer, string location) -> string;
auto superFamicomImport(vector<uint8_t>& buffer, string location) -> string;
2015-08-21 11:29:53 +00:00
//sg-1000.cpp
auto sg1000Manifest(string location) -> string;
auto sg1000Manifest(vector<uint8_t>& buffer, string location) -> string;
auto sg1000Import(vector<uint8_t>& buffer, string location) -> string;
//sc-3000.cpp
auto sc3000Manifest(string location) -> string;
auto sc3000Manifest(vector<uint8_t>& buffer, string location) -> string;
auto sc3000Import(vector<uint8_t>& buffer, string location) -> string;
//master-system.cpp
auto masterSystemManifest(string location) -> string;
auto masterSystemManifest(vector<uint8_t>& buffer, string location) -> string;
auto masterSystemImport(vector<uint8_t>& buffer, string location) -> string;
Update to v100r02 release. byuu says: Sigh ... I'm really not a good person. I'm inherently selfish. My responsibility and obligation right now is to work on loki, and then on the Tengai Makyou Zero translation, and then on improving the Famicom emulation. And yet ... it's not what I really want to do. That shouldn't matter; I should work on my responsibilities first. Instead, I'm going to be a greedy, self-centered asshole, and work on what I really want to instead. I'm really sorry, guys. I'm sure this will make a few people happy, and probably upset even more people. I'm also making zero guarantees that this ever gets finished. As always, I wish I could keep these things secret, so if I fail / give up, I could just drop it with no shame. But I would have to cut everyone out of the WIP process completely to make it happen. So, here goes ... This WIP adds the initial skeleton for Sega Mega Drive / Genesis emulation. God help us. (minor note: apparently the new extension for Mega Drive games is .md, neat. That's what I chose for the folders too. I thought it was .smd, so that'll be fixed in icarus for the next WIP.) (aside: this is why I wanted to get v100 out. I didn't want this code in a skeleton state in v100's source. Nor did I want really broken emulation, which the first release is sure to be, tarring said release.) ... So, basically, I've been ruminating on the legacy I want to leave behind with higan. 3D systems are just plain out. I'm never going to support them. They're too complex for my abilities, and they would run too slowly with my design style. I'm not willing to compromise my design ideals. And I would never want to play a 3D game system at native 240p/480i resolution ... but 1080p+ upscaling is not accurate, so that's a conflict I want to avoid entirely. It's also never going to emulate computer systems (X68K, PC-98, FM-Towns, etc) because holy shit that would completely destroy me. It's also never going emulate arcade machines. So I think of higan as a collection of 2D emulators for consoles and handhelds. I've gone over every major 2D gaming system there is, looking for ones with games I actually care about and enjoy. And I basically have five of those systems supported already. Looking at the remaining list, I see only three systems left that I have any interest in whatsoever: PC-Engine, Master System, Mega Drive. Again, I'm not in any way committing to emulating any of these, but ... if I had all of those in higan, I think I'd be content to really, truly, finally stop writing more emulators for the rest of my life. And so I decided to tackle the most difficult system first. If I'm successful, the Z80 core should cover a lot of the work on the SMS. And the HuC6280 should land somewhere between the NES and SNES in terms of difficulty ... closer to the NES. The systems that just don't appeal to me at all, which I will never touch, include, but are not limited to: * Atari 2600/5200/7800 * Lynx * Jaguar * Vectrex * Colecovision * Commodore 64 * Neo-Geo * Neo-Geo Pocket / Color * Virtual Boy * Super A'can * 32X * CD-i * etc, etc, etc. And really, even if something were mildly interesting in there ... we have to stop. I can't scale infinitely. I'm already way past my limit, but I'm doing this anyway. Too many cores bloats everything and kills quality on everything. I don't want higan to become MESS v2. I don't know what I'll do about the Famicom Disk System, PC-Engine CD, and Mega CD. I don't think I'll be able to achieve 60fps emulating the Mega CD, even if I tried to. I don't know what's going to happen here with even the Mega Drive. Maybe I'll get driven crazy with the documentation and quit. Maybe it'll end up being too complicated and I'll quit. Maybe the emulation will end up way too slow and I'll give up. Maybe it'll take me seven years to get any games playable at all. Maybe Steve Snake, AamirM and Mike Pavone will pool money to hire a hitman to come after me. Who knows. But this is what I want to do, so ... here goes nothing.
2016-07-09 04:21:37 +00:00
//mega-drive.cpp
auto megaDriveManifest(string location) -> string;
auto megaDriveManifest(vector<uint8_t>& buffer, string location) -> string;
auto megaDriveImport(vector<uint8_t>& buffer, string location) -> string;
Update to v101r30 release. byuu says: Changelog: - SMS: added cartridge ROM/RAM mirroring (fixes Alex Kidd) - SMS: fixed 8x16 sprite mode (fixes Wonder Boy, Ys graphics) - Z80: emulated "ex (sp),hl" instruction - Z80: fixed INx NF (should be set instead of cleared) - Z80: fixed loop condition check for CPxR, INxR, LDxR, OTxR (fixes walking in Wonder Boy) - SFC: removed Debugger and sfc/debugger.hpp - icarus: connected MS, GG, MD importing to the scan dialog - PCE: added emulation skeleton to higan and icarus At this point, Master System games are fairly highly compatible, sans audio. Game Gear games are running, but I need to crop the resolution and support the higher color palette that they can utilize. It's really something else the way they handled the resolution shrink on that thing. The last change is obviously going to be the biggest news. I'm very well aware it's not an ideal time to start on a new emulation core, with the MS and MD cores only just now coming to life with no audio support. But, for whatever reason, my heart's really set on working on the PC Engine. I wanted to write the final higan skeleton core, and get things ready so that whenever I'm in the mood to work on the PCE, I can do so. The skeleton is far and away the most tedious and obnoxious part of the emulator development, because it's basically all just lots of boilerplate templated code, lots of new files to create, etc. I really don't know how things are going to proceed ... but I can say with 99.9% certainty that this will be the final brand new core ever added to higan -- at least one written by me, that is. This was basically the last system from my childhood that I ever cared about. It's the last 2D system with games that I really enjoy playing. No other system is worth dividing my efforts and reducing the quality and amount of time to work on the systems I have. In the future, there will be potential for FDS, Mega CD and PCE-CD support. But those will all be add-ons, and they'll all be really difficult and challenge the entire design of higan's UI (it's entirely cartridge-driven at this time.) None of them will be entirely new cores like this one.
2017-01-11 20:27:30 +00:00
//pc-engine.cpp
auto pcEngineManifest(string location) -> string;
auto pcEngineManifest(vector<uint8_t>& buffer, string location) -> string;
auto pcEngineImport(vector<uint8_t>& buffer, string location) -> string;
Update to v102r03 release. byuu says: Changelog: - PCE: split VCE from VDC - HuC6280: changed bus from (uint21 addr) to (uint8 bank, uint13 addr) - added SuperGrafx emulation (adds secondary VDC, plus new VPC) The VDC now has no concept of the actual display raster timing, and instead is driven by Vpulse (start of frame) and Hpulse (start of scanline) signals from the VCE. One still can't render the start of the next scanline onto the current scanline through overly aggressive timings, but it shouldn't be too much more difficult to allow that to occur now. This process incurs quite a major speed hit, so low-end systems with Atom CPUs can't run things at 60fps anymore. The timing needs a lot of work. The pixels end up very jagged if the VCE doesn't output batches of 2-4 pixels at a time. But this should not be a requirement at all, so I'm not sure what's going wrong there. Yo, Bro and the 512-width mode of TV Sports Basketball is now broken as a result of these changes, and I'm not sure why. To load SuperGrafx games, you're going to have to change the .pce extensions to .sg or .sgx. Or you can manually move the games from the PC Engine folder to the SuperGrafx folder and change the game folder extensions. I have no way to tell the games apart. Mednafen uses CRC32 comparisons, and I may consider that since there's only five games, but I'm not sure yet. The only SuperGrafx game that's playable right now is Aldynes. And the priorities are all screwed up. I don't understand how the windows or the priorities work at all from sgxtech.txt, so ... yeah. It's pretty broken, but it's a start. I could really use some help with this, as I'm very lost right now with rendering :/ ----- Note that the SuperGrafx is technically its own system, it's not an add-on. As such, I'm giving it a separate .sys folder, and a separate library. There's debate over how to name this thing. "SuperGrafx" appears more popular than "Super Grafx". And you might also call it the "PC Engine SuperGrafx", but I decided to leave off the prefix so it appears more distinct.
2017-01-23 21:18:54 +00:00
//supergrafx.cpp
auto superGrafxManifest(string location) -> string;
auto superGrafxManifest(vector<uint8_t>& buffer, string location) -> string;
auto superGrafxImport(vector<uint8_t>& buffer, string location) -> string;
//colecovision.cpp
auto colecoVisionManifest(string location) -> string;
auto colecoVisionManifest(vector<uint8_t>& buffer, string location) -> string;
auto colecoVisionImport(vector<uint8_t>& buffer, string location) -> string;
//msx.cpp
auto msxManifest(string location) -> string;
auto msxManifest(vector<uint8_t>& buffer, string location) -> string;
auto msxImport(vector<uint8_t>& buffer, string location) -> string;
2015-08-21 11:29:53 +00:00
//game-boy.cpp
auto gameBoyManifest(string location) -> string;
auto gameBoyManifest(vector<uint8_t>& buffer, string location) -> string;
auto gameBoyImport(vector<uint8_t>& buffer, string location) -> string;
2015-08-21 11:29:53 +00:00
//game-boy-color.cpp
auto gameBoyColorManifest(string location) -> string;
auto gameBoyColorManifest(vector<uint8_t>& buffer, string location) -> string;
auto gameBoyColorImport(vector<uint8_t>& buffer, string location) -> string;
2015-08-21 11:29:53 +00:00
//game-boy-advance.cpp
auto gameBoyAdvanceManifest(string location) -> string;
auto gameBoyAdvanceManifest(vector<uint8_t>& buffer, string location) -> string;
auto gameBoyAdvanceImport(vector<uint8_t>& buffer, string location) -> string;
2015-08-21 11:29:53 +00:00
//game-gear.cpp
auto gameGearManifest(string location) -> string;
auto gameGearManifest(vector<uint8_t>& buffer, string location) -> string;
auto gameGearImport(vector<uint8_t>& buffer, string location) -> string;
2015-08-21 11:29:53 +00:00
//wonderswan.cpp
auto wonderSwanManifest(string location) -> string;
auto wonderSwanManifest(vector<uint8_t>& buffer, string location) -> string;
auto wonderSwanImport(vector<uint8_t>& buffer, string location) -> string;
//wonderswan-color.cpp
auto wonderSwanColorManifest(string location) -> string;
auto wonderSwanColorManifest(vector<uint8_t>& buffer, string location) -> string;
auto wonderSwanColorImport(vector<uint8_t>& buffer, string location) -> string;
//pocket-challenge-v2.cpp
auto pocketChallengeV2Manifest(string location) -> string;
auto pocketChallengeV2Manifest(vector<uint8_t>& buffer, string location) -> string;
auto pocketChallengeV2Import(vector<uint8_t>& buffer, string location) -> string;
//neo-geo-pocket.cpp
auto neoGeoPocketManifest(string location) -> string;
auto neoGeoPocketManifest(vector<uint8_t>& buffer, string location) -> string;
auto neoGeoPocketImport(vector<uint8_t>& buffer, string location) -> string;
//neo-geo-pocket-color.cpp
auto neoGeoPocketColorManifest(string location) -> string;
auto neoGeoPocketColorManifest(vector<uint8_t>& buffer, string location) -> string;
auto neoGeoPocketColorImport(vector<uint8_t>& buffer, string location) -> string;
//bs-memory.cpp
auto bsMemoryManifest(string location) -> string;
auto bsMemoryManifest(vector<uint8_t>& buffer, string location) -> string;
auto bsMemoryImport(vector<uint8_t>& buffer, string location) -> string;
//sufami-turbo.cpp
auto sufamiTurboManifest(string location) -> string;
auto sufamiTurboManifest(vector<uint8_t>& buffer, string location) -> string;
auto sufamiTurboImport(vector<uint8_t>& buffer, string location) -> string;
2015-08-21 11:29:53 +00:00
private:
string errorMessage;
vector<string> missingFiles;
};
namespace Database {
Markup::Node Famicom;
Markup::Node SuperFamicom;
Markup::Node SG1000;
Markup::Node SC3000;
Markup::Node MasterSystem;
Markup::Node MegaDrive;
Markup::Node PCEngine;
Markup::Node SuperGrafx;
Markup::Node ColecoVision;
Markup::Node MSX;
Markup::Node GameBoy;
Markup::Node GameBoyColor;
Markup::Node GameBoyAdvance;
Markup::Node GameGear;
Markup::Node WonderSwan;
Markup::Node WonderSwanColor;
Markup::Node PocketChallengeV2;
Markup::Node NeoGeoPocket;
Markup::Node NeoGeoPocketColor;
Markup::Node BSMemory;
Markup::Node SufamiTurbo;
2015-08-21 11:29:53 +00:00
};