2011-09-27 11:55:02 +00:00
|
|
|
struct Cartridge : property<Cartridge> {
|
2015-08-02 06:23:13 +00:00
|
|
|
enum class Region : unsigned { NTSC, PAL };
|
Update to v076r03 release.
byuu says:
Changelog:
- paths.cfg work completed
- save states/archives and cheat files for multi-slot games are more
intelligent now
For paths.cfg, there are three types of entries. Each have different
special prefixes.
Folder paths: sfc, bs, st, gb, filter, shader
By default, bsnes will remember the last path you loaded a file of said
type from. It will be prefixed with "recent/" in the file. Specify an
explicit hard-coded path to override this.
BIOS paths: satellaviewBios, sufamiTurboBios, superGameBoyBios
Remembers an explicit hard-coded path to the BIOS you selected last.
I was thinking that a nice feature would be for the "Load Special"
windows to pop open the slot A load dialog if a BIOS was selected.
Select a game from this popup and it loads directly, cancel it to get
the regular window to override the BIOS.
Save paths: srm, rtc, bsa, bst, cht, log
Paths to write various files that the emulator generates. Note: srm
groups bsp, bss and sav for now. Was being lazy.
There are four special prefixes for these:
"base/" -- gets replaced with the executable path
"user/" -- gets replaced with the same folder where bsnes.cfg goes
(%APPDATA%/bsnes or ~/.config/bsnes) -- good for hiding
files
"./" -- gets replaced with the current ROM path
"../" -- gets replaced with the folder above the current ROM path
If you want to go up two folders or more, then use a hard-coded path. If
that's not good enough, kill yourself because God hates you.
2011-03-04 08:57:00 +00:00
|
|
|
|
Update to v074r10 release.
byuu says:
Major WIP, countless changes. I really went to town on cleaning up the
source today with all kinds of new ideas. I'll post the ones I remember,
use diff -ru to get the rest.
What I like the most is my new within template:
template<unsigned lo, unsigned hi>
alwaysinline bool within(unsigned addr) {
static const unsigned mask = ~(hi ^ lo);
return (addr & mask) == lo;
}
Before, you would see code like this:
if((addr & 0xe0e000) == 0x206000) { //$20-3f:6000-7fff
The comment is basically necessary, and you have to trust that the mask
is right, or do the math yourself.
Now, it looks like this:
if(within<0x20, 0x3f, 0x6000, 0x7fff>(addr)) {
That's the same as within<0x206000, 0x3f7fff>, I just made an
SNES-variant to more closely simulate my XML mapping style:
20-3f:6000-7fff.
Now obviously this has limitations, it only works in base-2 and it can't
manage some tricky edge cases like (addr & 0x408000) == 0x008000 for
00-3f|80-bf:8000-ffff. But for the most part, I'll be using this where
I can. The Game Boy is fully ported over to it (via the MBCs), but the
SNES only has the BS-X town cartridge moved over so far. SuperFX and
SA-1 at the very least could benefit.
Next up, since the memory map is now static, there's really no reason to
remap the entire thing at power-on and reset. So it is now set up at
cartridge load and that's it. I moved the CPU/PPU/WRAM mapping out of
memory.cpp and into their respective processors. A bit of duplication
only because there are multiple processor cores for the different
profiles, but I'm not worried about that. This is also going to be
necessary to fix the debugger.
Next, Coprocessor::enable() actually does what I initially intended it
to now: it is called once to turn a chip on after cartridge load. It's
not called on power cycle anymore. This should help fix power-cycle on
my serial simulation code, and was needed to map the bus exactly one
time. Although most stuff is mapped through XML, some chips still need
some manual hooks for monitoring and such (eg S-DD1.)
Next, I've started killing off memory::, it was initially an
over-reaction to the question of where to put APURAM (in the SMP or
DSP?). The idea was to have this namespace that contained all memory for
everything. But it was very annoying and tedious, and various chips
ignored the convention anyway like ST-0011 RAM, which couldn't work
anyway since it is natively uint16 and not uint8. Cx4 will need 24-bit
RAM eventually, too. There's 8->24-bit functions in there now, because
the HLE code is hideous.
So far, all the cartridge.cpp memory:: types have been destroyed.
memory::cartrom, memory::cartram become cartridge.rom and cartridge.ram.
memory::cartrtc was moved into the SRTC and SPC7110 classes directly.
memory::bsxflash was moved into BSXFlash. memory::bsxram and
memory::bsxpram were moved into BSXCartridge (the town cartridge).
memory::st[AB](rom|ram) were moved into a new area,
snes/chip/sufamiturbo. The snes/chip moniker really doesn't work so
well, since it also has base units, and the serial communications stuff
which is through the controller port, but oh well, now it also has the
base structure for the Sufami Turbo cartridge too. So now we have
sufamiturbo.slotA.rom, sufamiturbo.slotB.ram, etc.
Next, the ST-0010/ST-0011 actually save the data RAM to disk. This
wasn't at all compatible with my old system, and I didn't want to keep
adding memory types to check inside the main UI cartridge RAM loading
and saving routines.
So I built a NonVolatileRAM vector inside SNES::Cartridge, and any chip
that has memory it wants to save and load from disk can append onto it
: data, size, id ("srm", "rtc", "nec", etc) and slot (0 = cartridge,
1 = slot A, 2 = slot B)
To load and save memory, we just do a simple: foreach(memory,
SNES::cartridge.nvram) load/saveMemory(memory).
As a result, you can now keep your save games in F1 Race of Champions II
and Hayazashi Nidan Morita Shougi. Technically I think Metal Combat
should work this way as well, having the RAM being part of the chip
itself, but for now that chip just writes directly into cartridge.ram,
so it also technically saves to disk for now.
To avoid a potential conflict with a manipulated memory map, BS-X SRAM
and PSRAM are now .bss and .bsp, and not .srm and .psr. Honestly I don't
like .srm as an extension either, but it doesn't bother me enough to
break save RAM compatibility with other emulators, so don't worry about
that changing.
I finally killed off MappedRAM initializing size to ~0 (-1U). A size of
zero means there is no memory there just the same. This was an old
holdover for handling MMIO mapping, if I recall correctly. Something
about a size of zero on MMIO-Memory objects causing it to wrap the
address, so ~0 would let it map direct addresses ... or something.
Whatever, that's not needed at all anymore.
BSXBase becomes BSXSatellaview, and I've defaulted the device to being
attached since it won't affect non-BSX games anyway. Eventually the GUI
needs to make that an option. BSXCart becomes BSXCartridge. BSXFlash
remains unchanged.
I probably need to make Coprocessor::disable() functions now to free up
memory on unload, but it shouldn't hurt anything the way it is.
libsnes is most definitely broken to all hell and back now, and the
debugger is still shot. I suppose we'll need some tricky code to work
with the old ID system, and we'll need to add some more IDs for the new
memory types.
2011-01-24 08:59:45 +00:00
|
|
|
MappedRAM rom;
|
|
|
|
MappedRAM ram;
|
|
|
|
|
2015-08-02 06:23:13 +00:00
|
|
|
auto loaded() const -> bool { return _loaded; }
|
|
|
|
auto sha256() const -> string { return _sha256; }
|
|
|
|
auto region() const -> Region { return _region; }
|
|
|
|
|
|
|
|
readonly<bool> hasICD2;
|
|
|
|
readonly<bool> hasMCC;
|
|
|
|
readonly<bool> hasNSSDIP;
|
|
|
|
readonly<bool> hasEvent;
|
|
|
|
readonly<bool> hasSA1;
|
|
|
|
readonly<bool> hasSuperFX;
|
|
|
|
readonly<bool> hasARMDSP;
|
|
|
|
readonly<bool> hasHitachiDSP;
|
|
|
|
readonly<bool> hasNECDSP;
|
|
|
|
readonly<bool> hasEpsonRTC;
|
|
|
|
readonly<bool> hasSharpRTC;
|
|
|
|
readonly<bool> hasSPC7110;
|
|
|
|
readonly<bool> hasSDD1;
|
|
|
|
readonly<bool> hasOBC1;
|
|
|
|
readonly<bool> hasMSU1;
|
|
|
|
|
|
|
|
readonly<bool> hasSuperGameBoySlot;
|
|
|
|
readonly<bool> hasSatellaviewSlot;
|
|
|
|
readonly<bool> hasSufamiTurboSlots;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
struct Mapping {
|
2015-12-14 09:41:06 +00:00
|
|
|
function<auto (uint, uint8) -> uint8> reader;
|
|
|
|
function<auto (uint, uint8) -> void> writer;
|
Update to v091r05 release.
[No prior releases were posted to the WIP thread. -Ed.]
byuu says:
Super Famicom mapping system has been reworked as discussed with the
mask= changes. offset becomes base, mode is gone. Also added support for
comma-separated fields in the address fields, to reduce the number of
map lines needed.
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<superfx revision="2">
<rom name="program.rom" size="0x200000"/>
<ram name="save.rwm" size="0x8000"/>
<map id="io" address="00-3f,80-bf:3000-32ff"/>
<map id="rom" address="00-3f:8000-ffff" mask="0x8000"/>
<map id="rom" address="40-5f:0000-ffff"/>
<map id="ram" address="00-3f,80-bf:6000-7fff" size="0x2000"/>
<map id="ram" address="70-71:0000-ffff"/>
</superfx>
</cartridge>
Or in BML:
cartridge region=NTSC
superfx revision=2
rom name=program.rom size=0x200000
ram name=save.rwm size=0x8000
map id=io address=00-3f,80-bf:3000-32ff
map id=rom address=00-3f:8000-ffff mask=0x8000
map id=rom address=40-5f:0000-ffff
map id=ram address=00-3f,80-bf:6000-7fff size=0x2000
map id=ram address=70-71:0000-ffff
As a result of the changes, old mappings will no longer work. The above
XML example will run Super Mario World 2: Yoshi's Island. Otherwise,
you'll have to write your own.
All that's left now is to work some sort of database mapping system in,
so I can start dumping carts en masse.
The NES changes that FitzRoy asked for are mostly in as well.
Also, part of the reason I haven't released a WIP ... but fuck it, I'm
not going to wait forever to post a new WIP.
I've added a skeleton driver to emulate Campus Challenge '92 and
Powerfest '94. There's no actual emulation, except for the stuff I can
glean from looking at the pictures of the board. It has a DSP-1 (so
SR/DR registers), four ROMs that map in and out, RAM, etc.
I've also added preliminary mapping to upload high scores to a website,
but obviously I need the ROMs first.
2012-10-09 08:25:32 +00:00
|
|
|
string addr;
|
2015-12-14 09:41:06 +00:00
|
|
|
uint size = 0;
|
|
|
|
uint base = 0;
|
|
|
|
uint mask = 0;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-08-02 06:23:13 +00:00
|
|
|
Mapping() = default;
|
2015-12-14 09:41:06 +00:00
|
|
|
Mapping(const function<uint8 (uint, uint8)>&, const function<void (uint, uint8)>&);
|
2012-05-26 08:18:42 +00:00
|
|
|
Mapping(SuperFamicom::Memory&);
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
2012-05-26 08:18:42 +00:00
|
|
|
vector<Mapping> mapping;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2012-05-26 08:18:42 +00:00
|
|
|
struct Memory {
|
|
|
|
unsigned id;
|
|
|
|
string name;
|
|
|
|
};
|
|
|
|
vector<Memory> memory;
|
|
|
|
|
Update to higan v091r14 and ananke v00r03 releases.
byuu says:
higan changelog:
- generates title displayed in emulator window by asking the core
- core builds title solely from "information/title" ... if it's not
there, you don't get a title at all
- sub-system load menu is gone ... since there are multiple revisions of
the SGB, this never really worked well anyway
- to load an SGB, BS-X or ST cartridge, load the base cartridge first
- "File->Load Game" moved to "Load->Import Game" ... may cause a bit of
confusion to new users, but I don't like having a single-item menu,
we'll just have to explain it to new users
- browser window redone to look like ananke
- home button here goes to ~/Emulation rather than just ~ like ananke,
since this is the home of game folders
- game folder icon is now the executable icon for the Tango theme
(orange diamond), meant to represent a complete game rather than
a game file or archive
ananke changelog:
- outputs GBC games to "Game Boy Color/" instead of "Game Boy/"
- adds the file basename to "information/title"
Known issues:
- using ananke to load a GB game trips the Super Famicom SGB mode and
fails (need to make the full-path auto-detection ignore non-bootable
systems)
- need to dump and test some BS-X media before releasing
- ananke lacks BS-X Satellaview cartridge support
- v092 isn't going to let you retarget the ananke/higan game folder path
of ~/Emulation, you will have to wait for a future version if that
bothers you so greatly
[Later, after the v092 release, byuu posted this additional changelog:
- kill laevateinn
- add title()
- add bootable, remove load
- combine file, library
- combine [][][] paths
- fix SFC subtype handling XML->BML
- update file browser to use buttons
- update file browser keyboard handling
- update system XML->BML
- fix sufami turbo hashing
- remove Cartridge::manifest
]
2012-12-25 05:31:55 +00:00
|
|
|
struct Information {
|
2013-01-21 12:27:15 +00:00
|
|
|
struct Markup {
|
|
|
|
string cartridge;
|
|
|
|
string gameBoy;
|
|
|
|
string satellaview;
|
|
|
|
string sufamiTurboA;
|
|
|
|
string sufamiTurboB;
|
|
|
|
} markup;
|
|
|
|
|
Update to higan v091r14 and ananke v00r03 releases.
byuu says:
higan changelog:
- generates title displayed in emulator window by asking the core
- core builds title solely from "information/title" ... if it's not
there, you don't get a title at all
- sub-system load menu is gone ... since there are multiple revisions of
the SGB, this never really worked well anyway
- to load an SGB, BS-X or ST cartridge, load the base cartridge first
- "File->Load Game" moved to "Load->Import Game" ... may cause a bit of
confusion to new users, but I don't like having a single-item menu,
we'll just have to explain it to new users
- browser window redone to look like ananke
- home button here goes to ~/Emulation rather than just ~ like ananke,
since this is the home of game folders
- game folder icon is now the executable icon for the Tango theme
(orange diamond), meant to represent a complete game rather than
a game file or archive
ananke changelog:
- outputs GBC games to "Game Boy Color/" instead of "Game Boy/"
- adds the file basename to "information/title"
Known issues:
- using ananke to load a GB game trips the Super Famicom SGB mode and
fails (need to make the full-path auto-detection ignore non-bootable
systems)
- need to dump and test some BS-X media before releasing
- ananke lacks BS-X Satellaview cartridge support
- v092 isn't going to let you retarget the ananke/higan game folder path
of ~/Emulation, you will have to wait for a future version if that
bothers you so greatly
[Later, after the v092 release, byuu posted this additional changelog:
- kill laevateinn
- add title()
- add bootable, remove load
- combine file, library
- combine [][][] paths
- fix SFC subtype handling XML->BML
- update file browser to use buttons
- update file browser keyboard handling
- update system XML->BML
- fix sufami turbo hashing
- remove Cartridge::manifest
]
2012-12-25 05:31:55 +00:00
|
|
|
struct Title {
|
|
|
|
string cartridge;
|
|
|
|
string gameBoy;
|
|
|
|
string satellaview;
|
|
|
|
string sufamiTurboA;
|
|
|
|
string sufamiTurboB;
|
|
|
|
} title;
|
|
|
|
} information;
|
Update to v092 release.
In the release thread, byuu says:
The first official release of higan has been posted. higan is the
new name for bsnes, and it continues with the latter's version
numbering.
Note that as of now, bsnes still exists. It's a module distributed
inside of higan. bsnes is now specific to my SNES emulator.
Due to last minute changes to the emulator interface, and missing
support in ananke, I wasn't able to include Cydrak's Nintendo DS
emulator dasShiny in this build, but I hope to do so in the next
release.
http://code.google.com/p/higan/downloads/list
For both new and experienced users, please read the higan user guide
first:
http://byuu.org/higan/user-guide
In the v091 WIP thread, byuu says:
r15->r16:
- BS-X MaskROM handling (partial ... need to split bsx/flash away
from sfc/chip, restructure code - it requires tagging the base
cart markup for now, but it needs to parse the slotted cart
markup)
- phoenixflags / phoenixlink += -m32
- nall/sort stability
- if(input.poll(scancode[activeScancode]) == false) return;
- MSU1 / USART need to use interface->path(1)
- MSU1 needs to use Markup::Document, not XML::Document
- case-insensitive folder listings
- remove nall/emulation/system.hpp files (move to ananke)
- remove rom/ram id= checks with indexing
X have cores ask for manifest.bml (skipped for v092's release, too
big a change)
- rename compatibility profile to balanced (so people don't assume
it has better compatibility than accuracy)
2013-01-14 12:10:20 +00:00
|
|
|
|
2015-08-02 06:23:13 +00:00
|
|
|
Cartridge() = default;
|
|
|
|
~Cartridge() { unload(); }
|
Update to higan v091r14 and ananke v00r03 releases.
byuu says:
higan changelog:
- generates title displayed in emulator window by asking the core
- core builds title solely from "information/title" ... if it's not
there, you don't get a title at all
- sub-system load menu is gone ... since there are multiple revisions of
the SGB, this never really worked well anyway
- to load an SGB, BS-X or ST cartridge, load the base cartridge first
- "File->Load Game" moved to "Load->Import Game" ... may cause a bit of
confusion to new users, but I don't like having a single-item menu,
we'll just have to explain it to new users
- browser window redone to look like ananke
- home button here goes to ~/Emulation rather than just ~ like ananke,
since this is the home of game folders
- game folder icon is now the executable icon for the Tango theme
(orange diamond), meant to represent a complete game rather than
a game file or archive
ananke changelog:
- outputs GBC games to "Game Boy Color/" instead of "Game Boy/"
- adds the file basename to "information/title"
Known issues:
- using ananke to load a GB game trips the Super Famicom SGB mode and
fails (need to make the full-path auto-detection ignore non-bootable
systems)
- need to dump and test some BS-X media before releasing
- ananke lacks BS-X Satellaview cartridge support
- v092 isn't going to let you retarget the ananke/higan game folder path
of ~/Emulation, you will have to wait for a future version if that
bothers you so greatly
[Later, after the v092 release, byuu posted this additional changelog:
- kill laevateinn
- add title()
- add bootable, remove load
- combine file, library
- combine [][][] paths
- fix SFC subtype handling XML->BML
- update file browser to use buttons
- update file browser keyboard handling
- update system XML->BML
- fix sufami turbo hashing
- remove Cartridge::manifest
]
2012-12-25 05:31:55 +00:00
|
|
|
|
2015-08-02 06:23:13 +00:00
|
|
|
auto title() -> string;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-08-02 06:23:13 +00:00
|
|
|
auto load() -> void;
|
|
|
|
auto unload() -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-08-02 06:23:13 +00:00
|
|
|
auto serialize(serializer&) -> void;
|
2013-01-21 12:27:15 +00:00
|
|
|
|
2015-08-02 06:23:13 +00:00
|
|
|
private:
|
|
|
|
auto loadSuperGameBoy() -> void;
|
|
|
|
auto loadSatellaview() -> void;
|
|
|
|
auto loadSufamiTurboA() -> void;
|
|
|
|
auto loadSufamiTurboB() -> void;
|
2013-01-21 12:27:15 +00:00
|
|
|
friend class Interface;
|
2015-08-02 06:23:13 +00:00
|
|
|
|
|
|
|
//markup.cpp
|
|
|
|
auto parseMarkup(const string&) -> void;
|
|
|
|
auto parseMarkupMap(Mapping&, Markup::Node) -> void;
|
|
|
|
auto parseMarkupMemory(MappedRAM&, Markup::Node, unsigned id, bool writable) -> void;
|
|
|
|
|
|
|
|
auto parseMarkupCartridge(Markup::Node) -> void;
|
|
|
|
auto parseMarkupICD2(Markup::Node) -> void;
|
|
|
|
auto parseMarkupMCC(Markup::Node) -> void;
|
|
|
|
auto parseMarkupSatellaview(Markup::Node) -> void;
|
|
|
|
auto parseMarkupSufamiTurbo(Markup::Node, bool slot) -> void;
|
|
|
|
auto parseMarkupNSS(Markup::Node) -> void;
|
|
|
|
auto parseMarkupEvent(Markup::Node) -> void;
|
|
|
|
auto parseMarkupSA1(Markup::Node) -> void;
|
|
|
|
auto parseMarkupSuperFX(Markup::Node) -> void;
|
|
|
|
auto parseMarkupARMDSP(Markup::Node) -> void;
|
|
|
|
auto parseMarkupHitachiDSP(Markup::Node, unsigned roms) -> void;
|
|
|
|
auto parseMarkupNECDSP(Markup::Node) -> void;
|
|
|
|
auto parseMarkupEpsonRTC(Markup::Node) -> void;
|
|
|
|
auto parseMarkupSharpRTC(Markup::Node) -> void;
|
|
|
|
auto parseMarkupSPC7110(Markup::Node) -> void;
|
|
|
|
auto parseMarkupSDD1(Markup::Node) -> void;
|
|
|
|
auto parseMarkupOBC1(Markup::Node) -> void;
|
|
|
|
auto parseMarkupMSU1(Markup::Node) -> void;
|
|
|
|
|
|
|
|
bool _loaded = false;
|
|
|
|
string _sha256;
|
|
|
|
Region _region = Region::NTSC;
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern Cartridge cartridge;
|