├── bsnes ├── uname.bat ├── obj │ ├── .gitignore │ ├── accuracy │ │ └── .gitignore │ ├── performance │ │ └── .gitignore │ └── compatibility │ │ └── .gitignore ├── out │ └── .gitignore ├── clean.bat ├── cc.bat ├── ui-qt │ ├── platform │ │ ├── platform_osx.cpp │ │ ├── platform_win.cpp │ │ └── platform_x.cpp │ ├── debugger │ │ ├── disassembler │ │ │ ├── processor │ │ │ │ ├── processor.cpp │ │ │ │ ├── processor.hpp │ │ │ │ ├── sfx_processor.hpp │ │ │ │ ├── smp_processor.hpp │ │ │ │ ├── common_processor.hpp │ │ │ │ ├── cpu_processor.hpp │ │ │ │ └── sgb_processor.hpp │ │ │ ├── symbolsview.moc.hpp │ │ │ └── symbols │ │ │ │ ├── adapters │ │ │ │ ├── vice_label_file.hpp │ │ │ │ ├── wla_symbol_file.hpp │ │ │ │ ├── fma_symbol_file.hpp │ │ │ │ └── symbol_file_interface.hpp │ │ │ │ └── symbol_file_adapters.hpp │ │ ├── ppu │ │ │ ├── cgram-viewer.moc.hpp │ │ │ ├── tile-renderer.hpp │ │ │ ├── cgram-widget.moc.hpp │ │ │ ├── base-renderer.hpp │ │ │ ├── tilemap-renderer.hpp │ │ │ ├── image-grid-widget.moc.hpp │ │ │ └── tilemap-viewer.moc.hpp │ │ ├── tracer.moc.hpp │ │ ├── tools │ │ │ └── properties.moc.hpp │ │ └── debuggerview.moc.hpp │ ├── data │ │ ├── logo.png │ │ └── icons-16x16 │ │ │ ├── go-up.png │ │ │ ├── dbg-run.png │ │ │ ├── dbg-break.png │ │ │ ├── dbg-step.png │ │ │ ├── folder-new.png │ │ │ ├── mem-find.png │ │ │ ├── dbg-step-out.png │ │ │ ├── dbg-step-over.png │ │ │ ├── item-check-off.png │ │ │ ├── item-check-on.png │ │ │ ├── item-radio-off.png │ │ │ ├── item-radio-on.png │ │ │ ├── mem-next-code.png │ │ │ ├── mem-next-data.png │ │ │ ├── mem-prev-code.png │ │ │ ├── mem-prev-data.png │ │ │ ├── mem-next-unknown.png │ │ │ └── mem-prev-unknown.png │ ├── resource │ │ └── resource.rc │ ├── base │ │ ├── base.cpp │ │ ├── about.moc.hpp │ │ ├── htmlviewer.moc.hpp │ │ ├── stateselect.moc.hpp │ │ ├── htmlviewer.cpp │ │ ├── filebrowser.moc.hpp │ │ └── loader.moc.hpp │ ├── input │ │ └── userinterface.hpp │ ├── tools │ │ ├── manifestviewer.moc.hpp │ │ ├── manifestviewer.cpp │ │ ├── tools.moc.hpp │ │ ├── effecttoggle.moc.hpp │ │ ├── soundviewer.moc.hpp │ │ ├── statemanager.moc.hpp │ │ └── cheatfinder.moc.hpp │ ├── link │ │ ├── reader.hpp │ │ ├── music.hpp │ │ ├── music.cpp │ │ └── reader.cpp │ ├── movie │ │ └── movie.hpp │ ├── settings │ │ ├── settings.moc.hpp │ │ ├── profile.moc.hpp │ │ ├── bsx.moc.hpp │ │ ├── audio.moc.hpp │ │ ├── paths.moc.hpp │ │ └── input.moc.hpp │ ├── state │ │ └── state.hpp │ ├── interface.hpp │ ├── utility │ │ └── utility.hpp │ └── main.cpp ├── data │ ├── bsnes.ico │ ├── bsnes.png │ ├── bsxdat │ │ ├── BSX0121-0.bin │ │ ├── BSX0123-0.bin │ │ ├── BSX0124-0.bin │ │ └── BSX0122-0.bin │ ├── bsnes.icns │ ├── bsnes_512.png │ ├── bsnes.desktop │ ├── default.smp.sym │ ├── default_sa1.cpu.sym │ ├── bsnes.Manifest │ ├── default.sgb.sym │ ├── Info.plist │ ├── bsnes.svg │ ├── default_sfx.cpu.sym │ └── default.sa1.sym ├── launcher │ ├── resource.rc │ ├── bsnes.ico │ ├── cc.sh │ ├── cc.bat │ └── bsnes.Manifest ├── Snesida │ ├── ida_plugin.h │ ├── ida_registers.h │ ├── snesida.vcxproj.user │ └── ida_debmod.h ├── thrift │ ├── thrift_32.lib │ ├── thrift_64.lib │ ├── thriftd_32.lib │ ├── thriftd_64.lib │ ├── thriftnb_32.lib │ ├── thriftnb_64.lib │ ├── thriftnbd_32.lib │ ├── thriftnbd_64.lib │ ├── libevent │ │ └── lib │ │ │ ├── event_32.lib │ │ │ ├── event_64.lib │ │ │ ├── event_core_32.lib │ │ │ ├── event_core_64.lib │ │ │ ├── event_extra_32.lib │ │ │ ├── event_extra_64.lib │ │ │ ├── cmake │ │ │ └── libevent │ │ │ │ └── LibeventConfigVersion.cmake │ │ │ └── pkgconfig │ │ │ ├── libevent_core.pc │ │ │ ├── libevent_extra.pc │ │ │ └── libevent.pc │ └── thrift │ │ ├── thrift_export.h │ │ ├── thrift-config.h │ │ ├── qt │ │ └── CMakeLists.txt │ │ ├── protocol │ │ └── TProtocolTypes.h │ │ ├── TBase.h │ │ └── windows │ │ └── SocketPair.h ├── snes │ ├── smp │ │ ├── mmio │ │ │ ├── mmio.hpp │ │ │ └── mmio.cpp │ │ ├── memory │ │ │ └── memory.hpp │ │ ├── timing │ │ │ └── timing.hpp │ │ ├── core │ │ │ ├── serialization.cpp │ │ │ ├── core.cpp │ │ │ └── memory.hpp │ │ ├── debugger │ │ │ └── debugger.hpp │ │ └── serialization.cpp │ ├── chip │ │ ├── superfx │ │ │ ├── mmio │ │ │ │ └── mmio.hpp │ │ │ ├── memory │ │ │ │ └── memory.hpp │ │ │ ├── timing │ │ │ │ └── timing.hpp │ │ │ ├── superfx.hpp │ │ │ └── bus │ │ │ │ └── bus.hpp │ │ ├── srtc │ │ │ ├── serialization.cpp │ │ │ └── srtc.hpp │ │ ├── obc1 │ │ │ ├── serialization.cpp │ │ │ └── obc1.hpp │ │ ├── serial │ │ │ ├── serialization.cpp │ │ │ └── serial.hpp │ │ ├── bsx │ │ │ └── bsx.cpp │ │ ├── sa1 │ │ │ ├── memory │ │ │ │ ├── memory.hpp │ │ │ │ └── memory.cpp │ │ │ ├── dma │ │ │ │ └── dma.hpp │ │ │ ├── sa1.hpp │ │ │ └── debugger │ │ │ │ └── debugger.hpp │ │ ├── supergameboy │ │ │ ├── serialization.cpp │ │ │ └── supergameboy.hpp │ │ ├── sdd1 │ │ │ ├── serialization.cpp │ │ │ └── sdd1.hpp │ │ ├── cx4 │ │ │ ├── bus.hpp │ │ │ └── bus.cpp │ │ ├── chip.hpp │ │ ├── msu1 │ │ │ ├── serialization.cpp │ │ │ └── msu1.hpp │ │ ├── st0018 │ │ │ └── st0018.hpp │ │ ├── necdsp │ │ │ ├── necdsp.hpp │ │ │ └── serialization.cpp │ │ └── spc7110 │ │ │ └── decomp.hpp │ ├── dsp │ │ ├── debugger │ │ │ └── debugger.hpp │ │ ├── misc.cpp │ │ └── counter.cpp │ ├── cheat │ │ ├── cheat-inline.hpp │ │ └── cheat.hpp │ ├── cpu │ │ ├── memory │ │ │ ├── memory.hpp │ │ │ └── memory.cpp │ │ ├── timing │ │ │ ├── timing.hpp │ │ │ └── joypad.cpp │ │ ├── core │ │ │ └── serialization.cpp │ │ └── debugger │ │ │ └── analyst.hpp │ ├── profile-accuracy.hpp │ ├── profile-compatibility.hpp │ ├── profile-performance.hpp │ ├── system │ │ └── random.cpp │ ├── ppu │ │ ├── counter │ │ │ └── serialization.cpp │ │ ├── debugger │ │ │ └── debugger.hpp │ │ └── screen │ │ │ └── screen.hpp │ ├── video │ │ └── video.hpp │ ├── memory │ │ └── serialization.cpp │ ├── alt │ │ ├── ppu │ │ │ ├── memory │ │ │ │ └── memory.hpp │ │ │ ├── render │ │ │ │ └── addsub.cpp │ │ │ └── debugger │ │ │ │ └── debugger.hpp │ │ ├── dsp │ │ │ ├── blargg_config.h │ │ │ ├── serialization.cpp │ │ │ └── dsp.hpp │ │ └── cpu │ │ │ └── memory.cpp │ ├── interface │ │ └── interface.hpp │ ├── scheduler │ │ ├── scheduler.cpp │ │ └── scheduler.hpp │ ├── audio │ │ └── audio.hpp │ ├── cartridge │ │ └── serialization.cpp │ └── config │ │ ├── config.hpp │ │ └── config.cpp ├── vstudio │ └── bsnes │ │ └── bsnes.vcxproj.user ├── sync.sh ├── libco │ ├── libco.h │ ├── libco.c │ └── fiber.c └── ruby │ ├── audio.hpp │ ├── input.hpp │ ├── video.hpp │ └── input │ └── x.cpp ├── snesfilter ├── uname.bat ├── obj │ └── .gitignore ├── cc.bat ├── clean.bat ├── sync.sh ├── lq2x │ └── lq2x.hpp ├── direct │ ├── direct.hpp │ └── direct.cpp ├── scale2x │ └── scale2x.hpp ├── pixellate2x │ ├── pixellate2x.hpp │ └── pixellate2x.cpp ├── snesfilter.hpp ├── ntsc │ └── snes_ntsc │ │ └── snes_ntsc_config.h ├── 2xsai │ └── 2xsai.hpp └── hq2x │ └── hq2x.hpp ├── snesmusic ├── uname.bat ├── obj │ └── .gitignore ├── clean.bat ├── cc.bat ├── bitmap_font.h ├── bitmap_font.cpp └── snesmusic.hpp ├── snesreader ├── uname.bat ├── obj │ └── .gitignore ├── cc.bat ├── clean.bat ├── sync.sh ├── snesreader.hpp ├── libjma │ ├── ariprice.h │ ├── crc32.h │ ├── ariconst.h │ ├── 7z.h │ └── lzma.cpp ├── 7z_C │ ├── 7zAlloc.h │ ├── readme.txt │ ├── 7zBuf.c │ ├── 7zCrc.h │ ├── 7zBuf.h │ ├── Bcj2.h │ └── 7zCrcOpt.c ├── filechooser.moc.hpp └── fex │ ├── Binary_Extractor.h │ ├── Gzip_Extractor.h │ ├── blargg_config.h │ ├── Zip7_Extractor.h │ ├── Rar_Extractor.h │ └── Gzip_Reader.h ├── supergameboy ├── uname.bat ├── obj │ └── .gitignore ├── cc.bat ├── clean.bat ├── sync.sh ├── libgambatte │ ├── src │ │ ├── counterdef.h │ │ ├── video │ │ │ ├── next_m0_time.cpp │ │ │ ├── next_m0_time.h │ │ │ └── lcddef.h │ │ ├── mem │ │ │ └── pakinfo_internal.h │ │ ├── sound │ │ │ ├── psgdef.h │ │ │ └── master_disabler.h │ │ ├── initstate.h │ │ ├── loadres.cpp │ │ ├── file │ │ │ └── file.cpp │ │ └── state_osd_elements.h │ └── include │ │ ├── pakinfo.h │ │ ├── debughandler.h │ │ ├── loadres.h │ │ ├── gbint.h │ │ └── inputgetter.h └── common │ ├── defined_ptr.h │ ├── scoped_ptr.h │ └── transfer_ptr.h ├── .gitmodules ├── .gitignore ├── README.md ├── common ├── nall │ ├── qt │ │ ├── concept.hpp │ │ ├── check-action.moc.hpp │ │ └── radio-action.moc.hpp │ ├── string │ │ ├── variadic.hpp │ │ ├── trim.hpp │ │ ├── strpos.hpp │ │ ├── platform.hpp │ │ └── strl.hpp │ ├── algorithm.hpp │ ├── random.hpp │ ├── foreach.hpp │ ├── detect.hpp │ ├── moduloarray.hpp │ ├── string.hpp │ ├── static.hpp │ ├── concept.hpp │ └── utility.hpp └── zlib │ ├── readme.txt │ └── inffast.h └── .gitattributes /bsnes/uname.bat: -------------------------------------------------------------------------------- 1 | @echo: 2 | -------------------------------------------------------------------------------- /bsnes/obj/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /bsnes/out/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /snesfilter/uname.bat: -------------------------------------------------------------------------------- 1 | @echo: 2 | -------------------------------------------------------------------------------- /snesmusic/uname.bat: -------------------------------------------------------------------------------- 1 | @echo: 2 | -------------------------------------------------------------------------------- /snesreader/uname.bat: -------------------------------------------------------------------------------- 1 | @echo: 2 | -------------------------------------------------------------------------------- /supergameboy/uname.bat: -------------------------------------------------------------------------------- 1 | @echo: 2 | -------------------------------------------------------------------------------- /snesfilter/obj/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /snesmusic/obj/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /snesreader/obj/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /supergameboy/obj/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /bsnes/clean.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make clean 2 | -------------------------------------------------------------------------------- /bsnes/obj/accuracy/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /bsnes/obj/performance/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /snesfilter/cc.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make 2 | @pause -------------------------------------------------------------------------------- /snesmusic/clean.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make clean 2 | -------------------------------------------------------------------------------- /snesreader/cc.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make 2 | @pause -------------------------------------------------------------------------------- /bsnes/cc.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make -j 2 2 | @pause 3 | -------------------------------------------------------------------------------- /bsnes/obj/compatibility/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore -------------------------------------------------------------------------------- /snesfilter/clean.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make clean 2 | -------------------------------------------------------------------------------- /snesmusic/cc.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make 2 | @pause 3 | -------------------------------------------------------------------------------- /snesreader/clean.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make clean 2 | -------------------------------------------------------------------------------- /supergameboy/cc.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make 2 | @pause 3 | -------------------------------------------------------------------------------- /supergameboy/clean.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make clean 2 | -------------------------------------------------------------------------------- /snesfilter/sync.sh: -------------------------------------------------------------------------------- 1 | rm -r nall 2 | cp -r ../nall ./nall 3 | -------------------------------------------------------------------------------- /snesreader/sync.sh: -------------------------------------------------------------------------------- 1 | rm -r nall 2 | cp -r ../nall ./nall 3 | -------------------------------------------------------------------------------- /supergameboy/sync.sh: -------------------------------------------------------------------------------- 1 | rm -r nall 2 | cp -r ../nall ./nall 3 | -------------------------------------------------------------------------------- /bsnes/ui-qt/platform/platform_osx.cpp: -------------------------------------------------------------------------------- 1 | void supressScreenSaver() { 2 | } 3 | 4 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/processor/processor.cpp: -------------------------------------------------------------------------------- 1 | #include "processor.hpp" 2 | -------------------------------------------------------------------------------- /bsnes/data/bsnes.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/data/bsnes.ico -------------------------------------------------------------------------------- /bsnes/data/bsnes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/data/bsnes.png -------------------------------------------------------------------------------- /bsnes/data/bsxdat/BSX0121-0.bin: -------------------------------------------------------------------------------- 1 | d Have fun with bsnes-plus' Satellaview support! -------------------------------------------------------------------------------- /bsnes/data/bsnes.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/data/bsnes.icns -------------------------------------------------------------------------------- /bsnes/launcher/resource.rc: -------------------------------------------------------------------------------- 1 | 1 24 "bsnes.Manifest" 2 | IDI_ICON1 ICON DISCARDABLE "bsnes.ico" 3 | -------------------------------------------------------------------------------- /snesmusic/bitmap_font.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/snesmusic/bitmap_font.h -------------------------------------------------------------------------------- /bsnes/Snesida/ida_plugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NAME "snesida" 4 | #define VERSION "1.0" 5 | -------------------------------------------------------------------------------- /bsnes/data/bsnes_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/data/bsnes_512.png -------------------------------------------------------------------------------- /bsnes/launcher/bsnes.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/launcher/bsnes.ico -------------------------------------------------------------------------------- /bsnes/ui-qt/data/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/logo.png -------------------------------------------------------------------------------- /snesmusic/bitmap_font.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/snesmusic/bitmap_font.cpp -------------------------------------------------------------------------------- /bsnes/thrift/thrift_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/thrift_32.lib -------------------------------------------------------------------------------- /bsnes/thrift/thrift_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/thrift_64.lib -------------------------------------------------------------------------------- /bsnes/thrift/thriftd_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/thriftd_32.lib -------------------------------------------------------------------------------- /bsnes/thrift/thriftd_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/thriftd_64.lib -------------------------------------------------------------------------------- /bsnes/thrift/thriftnb_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/thriftnb_32.lib -------------------------------------------------------------------------------- /bsnes/thrift/thriftnb_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/thriftnb_64.lib -------------------------------------------------------------------------------- /bsnes/launcher/cc.sh: -------------------------------------------------------------------------------- 1 | clear 2 | g++ -std=gnu++0x -s -O3 -fomit-frame-pointer -I.. -o ../out/bsnes launcher.cpp 3 | -------------------------------------------------------------------------------- /bsnes/snes/smp/mmio/mmio.hpp: -------------------------------------------------------------------------------- 1 | uint8 mmio_read(unsigned addr); 2 | void mmio_write(unsigned addr, uint8 data); 3 | -------------------------------------------------------------------------------- /bsnes/thrift/thriftnbd_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/thriftnbd_32.lib -------------------------------------------------------------------------------- /bsnes/thrift/thriftnbd_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/thriftnbd_64.lib -------------------------------------------------------------------------------- /bsnes/ui-qt/resource/resource.rc: -------------------------------------------------------------------------------- 1 | //1 24 "data/bsnes.Manifest" 2 | IDI_ICON1 ICON DISCARDABLE "data/bsnes.ico" 3 | -------------------------------------------------------------------------------- /bsnes/data/bsxdat/BSX0123-0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/data/bsxdat/BSX0123-0.bin -------------------------------------------------------------------------------- /bsnes/data/bsxdat/BSX0124-0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/data/bsxdat/BSX0124-0.bin -------------------------------------------------------------------------------- /bsnes/snes/chip/superfx/mmio/mmio.hpp: -------------------------------------------------------------------------------- 1 | uint8 mmio_read(unsigned addr); 2 | void mmio_write(unsigned addr, uint8 data); 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/qt"] 2 | path = external/qt 3 | url = https://github.com/devinacker/bsnes-plus-ext-qt.git 4 | -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/event_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/libevent/lib/event_32.lib -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/event_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/libevent/lib/event_64.lib -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/go-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/go-up.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/dbg-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/dbg-run.png -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/event_core_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/libevent/lib/event_core_32.lib -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/event_core_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/libevent/lib/event_core_64.lib -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/dbg-break.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/dbg-break.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/dbg-step.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/dbg-step.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/folder-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/folder-new.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/mem-find.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/mem-find.png -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/event_extra_32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/libevent/lib/event_extra_32.lib -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/event_extra_64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/thrift/libevent/lib/event_extra_64.lib -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/dbg-step-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/dbg-step-out.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/dbg-step-over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/dbg-step-over.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/item-check-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/item-check-off.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/item-check-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/item-check-on.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/item-radio-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/item-radio-off.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/item-radio-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/item-radio-on.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/mem-next-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/mem-next-code.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/mem-next-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/mem-next-data.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/mem-prev-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/mem-prev-code.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/mem-prev-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/mem-prev-data.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/mem-next-unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/mem-next-unknown.png -------------------------------------------------------------------------------- /bsnes/ui-qt/data/icons-16x16/mem-prev-unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/snesida/HEAD/bsnes/ui-qt/data/icons-16x16/mem-prev-unknown.png -------------------------------------------------------------------------------- /bsnes/snes/dsp/debugger/debugger.hpp: -------------------------------------------------------------------------------- 1 | class DSPDebugger : public DSP, public ChipDebugger { 2 | public: 3 | bool property(unsigned id, string &name, string &value); 4 | }; 5 | -------------------------------------------------------------------------------- /bsnes/snes/cheat/cheat-inline.hpp: -------------------------------------------------------------------------------- 1 | bool Cheat::active() const { return cheat_enabled; } 2 | bool Cheat::exists(uint16 addr) const { return bitmask[addr >> 3] & 1 << (addr & 7); } 3 | -------------------------------------------------------------------------------- /bsnes/snes/chip/srtc/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SRTC_CPP 2 | 3 | void SRTC::serialize(serializer &s) { 4 | s.integer(rtc_mode); 5 | s.integer(rtc_index); 6 | } 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /bsnes/data/bsnes.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=bsnes 3 | Comment=SNES emulator 4 | Exec=bsnes 5 | Icon=bsnes 6 | Terminal=false 7 | Type=Application 8 | Categories=Game;Emulator; 9 | -------------------------------------------------------------------------------- /bsnes/launcher/cc.bat: -------------------------------------------------------------------------------- 1 | @windres resource.rc resource.o 2 | @mingw32-g++ -std=gnu++0x -mwindows -s -O3 -fomit-frame-pointer -I.. -o ../out/bsnes launcher.cpp resource.o 3 | @del *.o 4 | @pause 5 | -------------------------------------------------------------------------------- /bsnes/snes/cpu/memory/memory.hpp: -------------------------------------------------------------------------------- 1 | void op_io(); 2 | debugvirtual uint8 op_read(uint32 addr); 3 | debugvirtual void op_write(uint32 addr, uint8 data); 4 | alwaysinline unsigned speed(unsigned addr) const; 5 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/counterdef.h: -------------------------------------------------------------------------------- 1 | #ifndef COUNTERDEF_H 2 | #define COUNTERDEF_H 3 | 4 | namespace gambatte { 5 | 6 | enum { disabled_time = 0xfffffffful }; 7 | 8 | } 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /bsnes/vstudio/bsnes/bsnes.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.dll 3 | *.dylib 4 | *.exe 5 | *.moc 6 | *.o 7 | *.rcc 8 | *.so 9 | *.so.1 10 | *.patch 11 | *.rar 12 | *.obj 13 | */out 14 | */bin 15 | /bsnes/vstudio/bsnes/ 16 | /bsnes/Snesida/x64/ 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # snesida 2 | 3 | IDA debugger plugin based on bsnes-plus fork of bsnes emulator. 4 | 5 | ![изображение](https://user-images.githubusercontent.com/7189309/114788734-aee19880-9d8a-11eb-991f-7537c0b14354.png) 6 | -------------------------------------------------------------------------------- /bsnes/snes/profile-accuracy.hpp: -------------------------------------------------------------------------------- 1 | namespace Info { 2 | static const char Profile[] = "Accuracy"; 3 | } 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /bsnes/ui-qt/base/base.cpp: -------------------------------------------------------------------------------- 1 | #include "../ui-base.hpp" 2 | 3 | #include "about.cpp" 4 | #include "filebrowser.cpp" 5 | #include "htmlviewer.cpp" 6 | #include "loader.cpp" 7 | #include "main.cpp" 8 | #include "stateselect.cpp" 9 | -------------------------------------------------------------------------------- /snesfilter/lq2x/lq2x.hpp: -------------------------------------------------------------------------------- 1 | class LQ2xFilter { 2 | public: 3 | void size(unsigned&, unsigned&, unsigned, unsigned); 4 | void render(uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 5 | } filter_lq2x; 6 | -------------------------------------------------------------------------------- /snesfilter/direct/direct.hpp: -------------------------------------------------------------------------------- 1 | class DirectFilter { 2 | public: 3 | void size(unsigned&, unsigned&, unsigned, unsigned); 4 | void render(uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 5 | } filter_direct; 6 | -------------------------------------------------------------------------------- /bsnes/snes/chip/obc1/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef OBC1_CPP 2 | 3 | void OBC1::serialize(serializer &s) { 4 | s.integer(status.address); 5 | s.integer(status.baseptr); 6 | s.integer(status.shift); 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /bsnes/snes/chip/serial/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SERIAL_CPP 2 | 3 | void Serial::serialize(serializer &s) { 4 | Processor::serialize(s); 5 | s.integer((bool&)data1); 6 | s.integer((bool&)data2); 7 | } 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /bsnes/snes/profile-compatibility.hpp: -------------------------------------------------------------------------------- 1 | namespace Info { 2 | static const char Profile[] = "Compatibility"; 3 | } 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /bsnes/snes/profile-performance.hpp: -------------------------------------------------------------------------------- 1 | namespace Info { 2 | static const char Profile[] = "Performance"; 3 | } 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /snesfilter/scale2x/scale2x.hpp: -------------------------------------------------------------------------------- 1 | class Scale2xFilter { 2 | public: 3 | void size(unsigned&, unsigned&, unsigned, unsigned); 4 | void render(uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 5 | } filter_scale2x; 6 | -------------------------------------------------------------------------------- /bsnes/snes/chip/bsx/bsx.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define BSX_CPP 4 | namespace SNES { 5 | #include "bsx_base.cpp" 6 | #include "bsx_cart.cpp" 7 | #include "bsx_flash.cpp" 8 | #include "serialization.cpp" 9 | } 10 | -------------------------------------------------------------------------------- /bsnes/snes/chip/sa1/memory/memory.hpp: -------------------------------------------------------------------------------- 1 | alwaysinline void op_io(); 2 | debugvirtual alwaysinline uint8 op_read(unsigned addr); 3 | debugvirtual alwaysinline void op_write(unsigned addr, uint8 data); 4 | 5 | uint8_t vbr_read(unsigned addr); 6 | -------------------------------------------------------------------------------- /snesreader/snesreader.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | namespace nall { class string; } 3 | 4 | extern "C" { 5 | const char* snesreader_supported(); 6 | bool snesreader_load(nall::string &filename, uint8_t *&data, unsigned &size); 7 | } 8 | -------------------------------------------------------------------------------- /snesfilter/pixellate2x/pixellate2x.hpp: -------------------------------------------------------------------------------- 1 | class Pixellate2xFilter { 2 | public: 3 | void size(unsigned&, unsigned&, unsigned, unsigned); 4 | void render(uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 5 | } filter_pixellate2x; 6 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/video/next_m0_time.cpp: -------------------------------------------------------------------------------- 1 | #include "next_m0_time.h" 2 | #include "ppu.h" 3 | 4 | void gambatte::NextM0Time::predictNextM0Time(PPU const &ppu) { 5 | predictedNextM0Time_ = ppu.predictedNextXposTime(lcd_hres + 7); 6 | } 7 | -------------------------------------------------------------------------------- /bsnes/ui-qt/input/userinterface.hpp: -------------------------------------------------------------------------------- 1 | extern InputGroup userInterfaceGeneral; 2 | extern InputGroup userInterfaceSystem; 3 | extern InputGroup userInterfaceEmulationSpeed; 4 | extern InputGroup userInterfaceStates; 5 | extern InputGroup userInterfaceVideoSettings; 6 | -------------------------------------------------------------------------------- /common/nall/qt/concept.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_QT_CONCEPT_HPP 2 | #define NALL_QT_CONCEPT_HPP 3 | 4 | #include 5 | 6 | namespace nall { 7 | template struct has_count> { enum { value = true }; }; 8 | } 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/mem/pakinfo_internal.h: -------------------------------------------------------------------------------- 1 | #ifndef PAKINFO_INTERNAL_H 2 | #define PAKINFO_INTERNAL_H 3 | 4 | #include "pakinfo.h" 5 | 6 | namespace gambatte { 7 | 8 | unsigned numRambanksFromH14x(unsigned char h147, unsigned char h149); 9 | 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /bsnes/snes/chip/superfx/memory/memory.hpp: -------------------------------------------------------------------------------- 1 | debugvirtual uint8 op_read(uint16 addr); 2 | alwaysinline uint8 peekpipe(); 3 | alwaysinline uint8 pipe(); 4 | 5 | void cache_flush(); 6 | uint8 cache_mmio_read(uint16 addr); 7 | void cache_mmio_write(uint16 addr, uint8 data); 8 | 9 | void memory_reset(); 10 | -------------------------------------------------------------------------------- /snesreader/libjma/ariprice.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMPRESSION_ARIPRICE_H 2 | #define __COMPRESSION_ARIPRICE_H 3 | 4 | namespace NCompression { 5 | namespace NArithmetic { 6 | 7 | const UINT32 kNumBitPriceShiftBits = 6; 8 | const UINT32 kBitPrice = 1 << kNumBitPriceShiftBits; 9 | 10 | }} 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /bsnes/Snesida/ida_registers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define RC_CPU (1 << 0) 4 | #define RC_PPU (1 << 1) 5 | 6 | enum class SNES_REGS : uint8_t 7 | { 8 | SR_A, 9 | SR_X, 10 | SR_Y, 11 | SR_D, 12 | SR_DB, 13 | SR_PC, 14 | SR_S, 15 | SR_P, 16 | SR_MFLAG, 17 | SR_XFLAG, 18 | SR_EFLAG, 19 | }; 20 | -------------------------------------------------------------------------------- /bsnes/snes/chip/supergameboy/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SUPERGAMEBOY_CPP 2 | 3 | void SuperGameBoy::serialize(serializer &s) { 4 | Processor::serialize(s); 5 | s.integer(speed); 6 | if (s.mode() == serializer::Load) update_speed(); 7 | if(sgb_serialize) sgb_serialize(s); 8 | } 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /common/nall/string/variadic.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_STRING_VARIADIC_HPP 2 | #define NALL_STRING_VARIADIC_HPP 3 | 4 | namespace nall { 5 | 6 | template inline void print(Args&&... args) { 7 | printf("%s", (const char*)string(std::forward(args)...)); 8 | } 9 | 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /bsnes/ui-qt/base/about.moc.hpp: -------------------------------------------------------------------------------- 1 | class AboutWindow : public Window { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | struct Logo : public QWidget { 7 | void paintEvent(QPaintEvent*); 8 | } *logo; 9 | QLabel *info; 10 | 11 | AboutWindow(); 12 | }; 13 | 14 | extern AboutWindow *aboutWindow; 15 | -------------------------------------------------------------------------------- /bsnes/snes/system/random.cpp: -------------------------------------------------------------------------------- 1 | Random random; 2 | 3 | void Random::seed(unsigned seed) { 4 | _random.seed = seed; 5 | } 6 | 7 | unsigned Random::operator()(unsigned result) { 8 | return config().random ? _random() : result; 9 | } 10 | 11 | void Random::serialize(serializer& s) { 12 | s.integer(_random.seed); 13 | } 14 | -------------------------------------------------------------------------------- /bsnes/ui-qt/tools/manifestviewer.moc.hpp: -------------------------------------------------------------------------------- 1 | class ManifestViewerWindow : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | ManifestViewerWindow(); 6 | 7 | void synchronize(); 8 | 9 | private: 10 | QVBoxLayout *layout; 11 | QPlainTextEdit *textEdit; 12 | 13 | }; 14 | 15 | extern ManifestViewerWindow *manifestViewerWindow; 16 | -------------------------------------------------------------------------------- /bsnes/ui-qt/base/htmlviewer.moc.hpp: -------------------------------------------------------------------------------- 1 | class HtmlViewerWindow : public Window { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QTextBrowser *document; 7 | 8 | void show(const char *title, const char *htmlData); 9 | HtmlViewerWindow(); 10 | 11 | public slots: 12 | }; 13 | 14 | extern HtmlViewerWindow *htmlViewerWindow; 15 | -------------------------------------------------------------------------------- /bsnes/data/bsxdat/BSX0122-0.bin: -------------------------------------------------------------------------------- 1 | @Convenience Center 2 | Welcome!Beach Shop 3 | Welcome!Secret PlaceHey!Special OrderHello?bsnes-plusyAccuracy is a good option!Before you know it, you are using it right now!000000000500 -------------------------------------------------------------------------------- /bsnes/snes/chip/sa1/dma/dma.hpp: -------------------------------------------------------------------------------- 1 | struct DMA { 2 | enum CDEN { DmaNormal = 0, DmaCharConversion = 1 }; 3 | enum SD { SourceROM = 0, SourceBWRAM = 1, SourceIRAM = 2 }; 4 | enum DD { DestIRAM = 0, DestBWRAM = 1 }; 5 | unsigned line; 6 | } dma; 7 | 8 | void dma_normal(); 9 | void dma_cc1(); 10 | uint8 dma_cc1_read(unsigned addr); 11 | void dma_cc2(); 12 | -------------------------------------------------------------------------------- /bsnes/snes/smp/mmio/mmio.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SMP_CPP 2 | 3 | uint8 SMP::mmio_read(unsigned addr) { 4 | if(!Memory::debugger_access()) 5 | cpu.synchronize_smp(); 6 | return port.smp_to_cpu[addr & 3]; 7 | } 8 | 9 | void SMP::mmio_write(unsigned addr, uint8 data) { 10 | cpu.synchronize_smp(); 11 | port.cpu_to_smp[addr & 3] = data; 12 | } 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /bsnes/sync.sh: -------------------------------------------------------------------------------- 1 | synchronize() { 2 | if [ -d ../"$1" ]; then 3 | test -d "$1" && rm -r "$1" 4 | cp -r ../"$1" ./"$1" 5 | fi 6 | } 7 | 8 | synchronize "libco" 9 | synchronize "nall" 10 | synchronize "ruby" 11 | 12 | test -d libco/doc && rm -r libco/doc 13 | test -d libco/test && rm -r libco/test 14 | test -d ruby/_test && rm -r ruby/_test 15 | 16 | -------------------------------------------------------------------------------- /bsnes/snes/ppu/counter/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef PPU_CPP 2 | 3 | void PPUcounter::serialize(serializer &s) { 4 | s.integer(status.hcounter); 5 | s.integer(status.vcounter); 6 | s.integer(status.frame); 7 | s.integer(status.lineclocks); 8 | s.integer(status.prev_lineclocks); 9 | s.array(status.fieldlines); 10 | s.integer(status.field); 11 | } 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /bsnes/snes/video/video.hpp: -------------------------------------------------------------------------------- 1 | class Video { 2 | private: 3 | bool frame_hires; 4 | bool frame_interlace; 5 | unsigned line_width[240]; 6 | 7 | void update(); 8 | void scanline(); 9 | void init(); 10 | 11 | static const uint8_t cursor[15 * 15]; 12 | void draw_cursor(uint16_t color, int x, int y); 13 | 14 | friend class System; 15 | }; 16 | 17 | extern Video video; 18 | -------------------------------------------------------------------------------- /bsnes/snes/smp/memory/memory.hpp: -------------------------------------------------------------------------------- 1 | public: 2 | uint8 op_debugread(uint16 addr); 3 | 4 | private: 5 | uint8 ram_read(uint16 addr); 6 | void ram_write(uint16 addr, uint8 data); 7 | 8 | uint8 op_busread(uint16 addr); 9 | void op_buswrite(uint16 addr, uint8 data); 10 | 11 | void op_io(); 12 | debugvirtual uint8 op_read(uint16 addr); 13 | debugvirtual void op_write(uint16 addr, uint8 data); 14 | -------------------------------------------------------------------------------- /bsnes/ui-qt/base/stateselect.moc.hpp: -------------------------------------------------------------------------------- 1 | class StateSelectWindow : public Window { 2 | Q_OBJECT 3 | 4 | public: 5 | QGridLayout *layout; 6 | QPushButton *slot[10]; 7 | 8 | void setSlot(unsigned slot); 9 | void keyReleaseEvent(QKeyEvent*); 10 | StateSelectWindow(); 11 | 12 | public slots: 13 | void slotClicked(); 14 | }; 15 | 16 | extern StateSelectWindow *stateSelectWindow; 17 | -------------------------------------------------------------------------------- /bsnes/ui-qt/link/reader.hpp: -------------------------------------------------------------------------------- 1 | class Reader : public library { 2 | public: 3 | string compressionList; 4 | string extensionList; 5 | 6 | function supported; 7 | function load; 8 | 9 | const char* direct_supported(); 10 | bool direct_load(string&, uint8_t*&, unsigned&); 11 | 12 | Reader(); 13 | }; 14 | 15 | extern Reader reader; 16 | -------------------------------------------------------------------------------- /common/nall/algorithm.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_ALGORITHM_HPP 2 | #define NALL_ALGORITHM_HPP 3 | 4 | #undef min 5 | #undef max 6 | 7 | namespace nall { 8 | template T min(const T &t, const U &u) { 9 | return t < u ? t : u; 10 | } 11 | 12 | template T max(const T &t, const U &u) { 13 | return t > u ? t : u; 14 | } 15 | } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /snesreader/7z_C/7zAlloc.h: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.h -- Allocation functions 2 | 2010-10-29 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_ALLOC_H 5 | #define __7Z_ALLOC_H 6 | 7 | #include 8 | 9 | void *SzAlloc(void *p, size_t size); 10 | void SzFree(void *p, void *address); 11 | 12 | void *SzAllocTemp(void *p, size_t size); 13 | void SzFreeTemp(void *p, void *address); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /bsnes/data/default.smp.sym: -------------------------------------------------------------------------------- 1 | ; default registers used for SMP 2 | 3 | [labels] 4 | 00:00F0 SMP.TEST 5 | 00:00F1 SMP.CONTROL 6 | 00:00F2 SMP.DSP_ADDR 7 | 00:00F3 SMP.DSP_DATA 8 | 00:00F4 SMP.PORT0 9 | 00:00F5 SMP.PORT1 10 | 00:00F6 SMP.PORT2 11 | 00:00F7 SMP.PORT3 12 | 00:00FA SMP.TIMER0 13 | 00:00FB SMP.TIMER1 14 | 00:00FC SMP.TIMER2 15 | 00:00FD SMP.COUNTER0 16 | 00:00FE SMP.COUNTER1 17 | 00:00FF SMP.COUNTER2 18 | -------------------------------------------------------------------------------- /bsnes/snes/memory/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef MEMORY_CPP 2 | 3 | void Bus::serialize(serializer &s) { 4 | s.array(memory::wram.data(), memory::wram.size()); 5 | s.array(memory::apuram.data(), memory::apuram.size()); 6 | s.array(memory::vram.data(), memory::vram.size()); 7 | s.array(memory::oam.data(), memory::oam.size()); 8 | s.array(memory::cgram.data(), memory::cgram.size()); 9 | } 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /bsnes/ui-qt/movie/movie.hpp: -------------------------------------------------------------------------------- 1 | class Movie { 2 | public: 3 | enum State { Inactive, Playback, Record } state; 4 | 5 | void chooseFile(); 6 | void play(const string &filename); 7 | void record(); 8 | void stop(); 9 | 10 | Movie(); 11 | 12 | //private: 13 | file fp; 14 | 15 | string makeFilename() const; 16 | int16_t read(); 17 | void write(int16_t value); 18 | }; 19 | 20 | extern Movie movie; 21 | -------------------------------------------------------------------------------- /common/zlib/readme.txt: -------------------------------------------------------------------------------- 1 | This is NOT the complete zlib distribution; it is just a subset of the 2 | source needed by the File_Extractor library. I've made some minor 3 | changes: 4 | 5 | * Enabled DYNAMIC_CRC_TABLE in zconf.h, to reduce executable size 6 | slightly. 7 | * Made z_stream_s's msg const char* to eliminate many warnings. 8 | 9 | You can remove these sources and link to your own copy of zlib if 10 | desired. 11 | -------------------------------------------------------------------------------- /bsnes/snes/alt/ppu/memory/memory.hpp: -------------------------------------------------------------------------------- 1 | uint16 get_vram_address(); 2 | 3 | debugvirtual uint8 vram_mmio_read(uint16 addr); 4 | debugvirtual void vram_mmio_write(uint16 addr, uint8 data); 5 | 6 | debugvirtual uint8 oam_mmio_read(uint16 addr); 7 | debugvirtual void oam_mmio_write(uint16 addr, uint8 data); 8 | 9 | debugvirtual uint8 cgram_mmio_read(uint16 addr); 10 | debugvirtual void cgram_mmio_write(uint16 addr, uint8 data); 11 | -------------------------------------------------------------------------------- /snesreader/filechooser.moc.hpp: -------------------------------------------------------------------------------- 1 | class FileChooser : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | lstring list; 6 | string name; 7 | string exec(); 8 | 9 | FileChooser(); 10 | 11 | private slots: 12 | void load(); 13 | 14 | private: 15 | QVBoxLayout *layout; 16 | QListWidget *listWidget; 17 | QHBoxLayout *controlLayout; 18 | QPushButton *okButton; 19 | QPushButton *cancelButton; 20 | } *fileChooser; 21 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/symbolsview.moc.hpp: -------------------------------------------------------------------------------- 1 | class Symbols; 2 | 3 | class SymbolsView : public Window { 4 | Q_OBJECT 5 | 6 | public: 7 | SymbolsView(class DisasmProcessor *processor); 8 | 9 | QVBoxLayout *layout; 10 | QTreeWidget *list; 11 | 12 | QLineEdit *search; 13 | 14 | public slots: 15 | void synchronize(); 16 | void bind(QTreeWidgetItem*, int); 17 | 18 | private: 19 | class DisasmProcessor *processor; 20 | }; 21 | -------------------------------------------------------------------------------- /bsnes/snes/chip/sdd1/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SDD1_CPP 2 | 3 | void SDD1::serialize(serializer &s) { 4 | s.integer(sdd1_enable); 5 | s.integer(xfer_enable); 6 | s.array(mmc); 7 | 8 | for(unsigned n = 0; n < 8; n++) { 9 | s.integer(dma[n].addr); 10 | s.integer(dma[n].size); 11 | } 12 | 13 | s.array(buffer.data); 14 | s.integer(buffer.offset); 15 | s.integer(buffer.size); 16 | s.integer(buffer.ready); 17 | } 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /common/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /supergameboy/common/defined_ptr.h: -------------------------------------------------------------------------------- 1 | #ifndef DEFINED_PTR_H 2 | #define DEFINED_PTR_H 3 | 4 | template 5 | inline T * defined_ptr(T *t) { 6 | typedef char type_is_defined[sizeof *t ? 1 : -1]; 7 | (void) sizeof(type_is_defined); 8 | return t; 9 | } 10 | 11 | template 12 | inline void defined_delete(T *t) { delete defined_ptr(t); } 13 | 14 | struct defined_deleter { template static void del(T *p) { defined_delete(p); } }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/cmake/libevent/LibeventConfigVersion.cmake: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "2.1.12") 2 | 3 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 4 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 5 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 6 | else() 7 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 8 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 9 | set(PACKAGE_VERSION_EXACT TRUE) 10 | endif() 11 | endif() 12 | -------------------------------------------------------------------------------- /bsnes/ui-qt/settings/settings.moc.hpp: -------------------------------------------------------------------------------- 1 | class SettingsWindow : public Window { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QTabWidget *tab; 7 | QScrollArea *profileArea; 8 | QScrollArea *videoArea; 9 | QScrollArea *audioArea; 10 | QScrollArea *inputArea; 11 | QScrollArea *pathArea; 12 | QScrollArea *advancedArea; 13 | QScrollArea *bsxArea; 14 | 15 | SettingsWindow(); 16 | 17 | public slots: 18 | }; 19 | 20 | extern SettingsWindow *settingsWindow; 21 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/ppu/cgram-viewer.moc.hpp: -------------------------------------------------------------------------------- 1 | class CgramViewer : public Window { 2 | Q_OBJECT 3 | 4 | public: 5 | CgramViewer(); 6 | 7 | void autoUpdate(); 8 | 9 | public slots: 10 | void show(); 11 | void refresh(); 12 | 13 | private: 14 | QHBoxLayout *layout; 15 | QVBoxLayout *controlLayout; 16 | QCheckBox *autoUpdateBox; 17 | QPushButton *refreshButton; 18 | 19 | CgramWidget *cgramWidget; 20 | QLabel *colorInfo; 21 | }; 22 | 23 | extern CgramViewer *cgramViewer; 24 | -------------------------------------------------------------------------------- /bsnes/ui-qt/state/state.hpp: -------------------------------------------------------------------------------- 1 | class State { 2 | public: 3 | unsigned active; 4 | bool save(unsigned); 5 | bool load(unsigned); 6 | 7 | void frame(); 8 | void resetHistory(); 9 | bool rewind(); 10 | 11 | State(); 12 | ~State(); 13 | 14 | private: 15 | serializer *history; 16 | unsigned historySize; 17 | unsigned historyIndex; 18 | unsigned historyCount; 19 | unsigned frameCounter; 20 | 21 | bool allowed() const; 22 | string name(unsigned slot) const; 23 | }; 24 | 25 | extern State state; 26 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/video/next_m0_time.h: -------------------------------------------------------------------------------- 1 | #ifndef NEXT_M0_TIME_H_ 2 | #define NEXT_M0_TIME_H_ 3 | 4 | namespace gambatte { 5 | 6 | class NextM0Time { 7 | public: 8 | NextM0Time() : predictedNextM0Time_(0) {} 9 | void predictNextM0Time(class PPU const &v); 10 | void invalidatePredictedNextM0Time() { predictedNextM0Time_ = 0; } 11 | unsigned long predictedNextM0Time() const { return predictedNextM0Time_; } 12 | 13 | private: 14 | unsigned long predictedNextM0Time_; 15 | }; 16 | 17 | } 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /common/nall/random.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_RANDOM_HPP 2 | #define NALL_RANDOM_HPP 3 | 4 | namespace nall { 5 | //pseudo-random number generator 6 | inline unsigned prng() { 7 | static unsigned n = 0; 8 | return n = (n >> 1) ^ (((n & 1) - 1) & 0xedb88320); 9 | } 10 | 11 | struct random_cyclic { 12 | unsigned seed; 13 | inline unsigned operator()() { 14 | return seed = (seed >> 1) ^ (((seed & 1) - 1) & 0xedb88320); 15 | } 16 | random_cyclic() : seed(0) {} 17 | }; 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /snesfilter/snesfilter.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | class QWidget; 3 | namespace nall { class configuration; } 4 | 5 | extern "C" { 6 | const char* snesfilter_supported(); 7 | void snesfilter_configuration(nall::configuration&); 8 | void snesfilter_colortable(const uint32_t*); 9 | void snesfilter_size(unsigned, unsigned&, unsigned&, unsigned, unsigned); 10 | void snesfilter_render(unsigned, uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 11 | QWidget* snesfilter_settings(unsigned); 12 | } 13 | -------------------------------------------------------------------------------- /snesmusic/snesmusic.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | namespace nall { class string; } 3 | 4 | extern "C" { 5 | const char* snesmusic_supported(); 6 | void snesmusic_unload(); 7 | bool snesmusic_loaded(); 8 | 9 | bool snesmusic_load_spc(nall::string &filename, uint8_t *&dump, 10 | uint16_t &pc, uint8_t (®s)[4], uint8_t &p); 11 | bool snesmusic_load_snsf(nall::string &filename, uint8_t *&data, unsigned &size); 12 | 13 | void snesmusic_render(uint16_t*, unsigned, unsigned, unsigned); 14 | } 15 | -------------------------------------------------------------------------------- /bsnes/snes/interface/interface.hpp: -------------------------------------------------------------------------------- 1 | class Interface { 2 | public: 3 | virtual void video_extras(uint16_t *data, unsigned width, unsigned height) {} 4 | virtual void video_refresh(const uint16_t *data, unsigned width, unsigned height) {} 5 | virtual void audio_sample(uint16_t l_sample, uint16_t r_sample) {} 6 | virtual void input_poll() {} 7 | virtual int16_t input_poll(bool port, Input::Device device, unsigned index, unsigned id) { return 0; } 8 | 9 | virtual void message(const string &text) { print(text, "\n"); } 10 | }; 11 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/sound/psgdef.h: -------------------------------------------------------------------------------- 1 | #ifndef PSGDEF_H 2 | #define PSGDEF_H 3 | 4 | namespace gambatte { 5 | 6 | enum { 7 | psg_nr10_rsh = 0x07, 8 | psg_nr10_neg = 0x08, 9 | psg_nr10_time = 0x70 10 | }; 11 | 12 | enum { 13 | psg_nr2_step = 0x07, 14 | psg_nr2_inc = 0x08, 15 | psg_nr2_initvol = 0xF0 16 | }; 17 | 18 | enum { 19 | psg_nr43_r = 0x07, 20 | psg_nr43_7biten = 0x08, 21 | psg_nr43_s = 0xF0 22 | }; 23 | 24 | enum { 25 | psg_nr4_lcen = 0x40, 26 | psg_nr4_init = 0x80 27 | }; 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/pkgconfig/libevent_core.pc: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=D:/git/smd_ida_tools2/Gensida/libevent 4 | exec_prefix=D:/git/smd_ida_tools2/Gensida/libevent 5 | libdir=D:/git/smd_ida_tools2/Gensida/libevent/lib 6 | includedir=D:/git/smd_ida_tools2/Gensida/libevent/include 7 | 8 | Name: libevent_core 9 | Description: libevent_core 10 | Version: 2.1.12 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -levent_core 14 | Libs.private: -Lws2_32 -Lshell32 -Ladvapi32 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /bsnes/snes/chip/superfx/timing/timing.hpp: -------------------------------------------------------------------------------- 1 | inline unsigned cache_access_speed(); 2 | inline unsigned memory_access_speed(); 3 | 4 | bool r15_modified; 5 | 6 | void add_clocks(unsigned clocks); 7 | 8 | void rombuffer_sync(); 9 | void rombuffer_update(); 10 | debugvirtual uint8 rombuffer_read(); 11 | 12 | void rambuffer_sync(); 13 | debugvirtual uint8 rambuffer_read(uint16 addr); 14 | debugvirtual void rambuffer_write(uint16 addr, uint8 data); 15 | 16 | void r14_modify(uint16); 17 | void r15_modify(uint16); 18 | 19 | void timing_reset(); 20 | -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/pkgconfig/libevent_extra.pc: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=D:/git/smd_ida_tools2/Gensida/libevent 4 | exec_prefix=D:/git/smd_ida_tools2/Gensida/libevent 5 | libdir=D:/git/smd_ida_tools2/Gensida/libevent/lib 6 | includedir=D:/git/smd_ida_tools2/Gensida/libevent/include 7 | 8 | Name: libevent_extra 9 | Description: libevent_extra 10 | Version: 2.1.12 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -levent_extra 14 | Libs.private: -Lws2_32 -Lshell32 -Ladvapi32 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /bsnes/launcher/bsnes.Manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /bsnes/snes/chip/obc1/obc1.hpp: -------------------------------------------------------------------------------- 1 | class OBC1 : public Memory { 2 | public: 3 | void init(); 4 | void enable(); 5 | void power(); 6 | void reset(); 7 | 8 | uint8 read(unsigned addr); 9 | void write(unsigned addr, uint8 data); 10 | 11 | void serialize(serializer&); 12 | OBC1(); 13 | ~OBC1(); 14 | 15 | private: 16 | uint8 ram_read(unsigned addr); 17 | void ram_write(unsigned addr, uint8 data); 18 | 19 | struct { 20 | uint16 address; 21 | uint16 baseptr; 22 | uint16 shift; 23 | } status; 24 | }; 25 | 26 | extern OBC1 obc1; 27 | -------------------------------------------------------------------------------- /common/nall/foreach.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_FOREACH_HPP 2 | #define NALL_FOREACH_HPP 3 | 4 | #include 5 | #include 6 | 7 | #undef foreach 8 | #define foreach(iter, object) \ 9 | for(unsigned foreach_counter = 0, foreach_limit = container_size(object), foreach_once = 0, foreach_broken = 0; foreach_counter < foreach_limit && foreach_broken == 0; foreach_counter++, foreach_once = 0) \ 10 | for(auto &iter = object[foreach_counter]; foreach_once == 0 && (foreach_broken = 1); foreach_once++, foreach_broken = 0) 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /bsnes/thrift/libevent/lib/pkgconfig/libevent.pc: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=D:/git/smd_ida_tools2/Gensida/libevent 4 | exec_prefix=D:/git/smd_ida_tools2/Gensida/libevent 5 | libdir=D:/git/smd_ida_tools2/Gensida/libevent/lib 6 | includedir=D:/git/smd_ida_tools2/Gensida/libevent/include 7 | 8 | Name: libevent 9 | Description: libevent is an asynchronous notification event loop library 10 | Version: 2.1.12 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -levent 14 | Libs.private: -Lws2_32 -Lshell32 -Ladvapi32 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /bsnes/thrift/thrift/thrift_export.h: -------------------------------------------------------------------------------- 1 | #ifndef THRIFT_EXPORT_H 2 | #define THRIFT_EXPORT_H 3 | 4 | #ifdef THRIFT_STATIC_DEFINE 5 | # define THRIFT_EXPORT 6 | #elif defined(_MSC_VER ) 7 | # ifndef THRIFT_EXPORT 8 | # ifdef thrift_EXPORTS 9 | /* We are building this library */ 10 | # define THRIFT_EXPORT __declspec(dllexport) 11 | # else 12 | /* We are using this library */ 13 | # define THRIFT_EXPORT __declspec(dllimport) 14 | # endif 15 | # endif 16 | #else 17 | # define THRIFT_EXPORT 18 | #endif 19 | 20 | #endif /* THRIFT_EXPORT_H */ 21 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/include/pakinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef GAMBATTE_PAKINFO_H 2 | #define GAMBATTE_PAKINFO_H 3 | 4 | #include 5 | 6 | namespace gambatte { 7 | 8 | class PakInfo { 9 | public: 10 | PakInfo(); 11 | PakInfo(bool multipak, unsigned rombanks, unsigned char const romheader[]); 12 | bool headerChecksumOk() const; 13 | std::string const mbc() const; 14 | unsigned rambanks() const; 15 | unsigned rombanks() const; 16 | 17 | private: 18 | unsigned short flags_; 19 | unsigned short rombanks_; 20 | unsigned char h144x_[12]; 21 | }; 22 | 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /bsnes/snes/smp/timing/timing.hpp: -------------------------------------------------------------------------------- 1 | template 2 | class sSMPTimer { 3 | public: 4 | uint8 stage0_ticks; 5 | uint8 stage1_ticks; 6 | uint8 stage2_ticks; 7 | uint8 stage3_ticks; 8 | bool current_line; 9 | bool enabled; 10 | uint8 target; 11 | 12 | void step(unsigned clocks); 13 | void sync_stage1(); 14 | }; 15 | 16 | sSMPTimer<128> t0; 17 | sSMPTimer<128> t1; 18 | sSMPTimer< 16> t2; 19 | 20 | alwaysinline void wait(uint16 addr, bool half = false); 21 | alwaysinline void add_clocks(unsigned clocks); 22 | alwaysinline void step_timers(unsigned clocks); 23 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/symbols/adapters/vice_label_file.hpp: -------------------------------------------------------------------------------- 1 | #include "symbol_file_interface.hpp" 2 | 3 | class SymbolMap; 4 | 5 | class ViceLabelFile : public SymbolFileInterface { 6 | public: 7 | ViceLabelFile() {} 8 | virtual ~ViceLabelFile() {} 9 | 10 | const char *getName() const; 11 | const char *getDescription() const; 12 | 13 | int32_t scoreReadString(const nall::lstring &rows) const; 14 | bool read(const nall::lstring &rows, SymbolMap *map) const; 15 | 16 | bool write(nall::file &file, SymbolMap *map) const; 17 | 18 | uint32_t getFeatures() const; 19 | }; 20 | -------------------------------------------------------------------------------- /bsnes/snes/chip/srtc/srtc.hpp: -------------------------------------------------------------------------------- 1 | class SRTC : public MMIO { 2 | public: 3 | void init(); 4 | void enable(); 5 | void power(); 6 | void reset(); 7 | 8 | uint8 mmio_read(unsigned addr); 9 | void mmio_write(unsigned addr, uint8 data); 10 | 11 | void serialize(serializer&); 12 | SRTC(); 13 | 14 | private: 15 | static const unsigned months[12]; 16 | enum RtcMode { RtcReady, RtcCommand, RtcRead, RtcWrite }; 17 | unsigned rtc_mode; 18 | signed rtc_index; 19 | 20 | void update_time(); 21 | unsigned weekday(unsigned year, unsigned month, unsigned day); 22 | }; 23 | 24 | extern SRTC srtc; 25 | -------------------------------------------------------------------------------- /bsnes/data/default_sa1.cpu.sym: -------------------------------------------------------------------------------- 1 | ; default registers used for SA1 (from CPU side) 2 | 3 | [labels] 4 | 00:2200 SA1.CCNT 5 | 00:2201 SA1.SIE 6 | 00:2202 SA1.SIC 7 | 00:2203 SA1.CRV 8 | 00:2204 SA1.CRVH 9 | 00:2205 SA1.CNV 10 | 00:2206 SA1.CNVH 11 | 00:2207 SA1.CIV 12 | 00:2208 SA1.CIVH 13 | 00:2220 SA1.CXB 14 | 00:2221 SA1.DXB 15 | 00:2222 SA1.EXB 16 | 00:2223 SA1.FXB 17 | 00:2224 SA1.BMAPS 18 | 00:2226 SA1.SBWE 19 | 00:2228 SA1.BWPA 20 | 00:2229 SA1.SIWP 21 | 00:2231 SA1.CDMA 22 | 00:2232 SA1.SDA 23 | 00:2233 SA1.SDAM 24 | 00:2234 SA1.SDAH 25 | 00:2235 SA1.DDA 26 | 00:2236 SA1.DDAM 27 | 00:2237 SA1.DDAH 28 | 00:2300 SA1.SFR 29 | -------------------------------------------------------------------------------- /bsnes/snes/cpu/timing/timing.hpp: -------------------------------------------------------------------------------- 1 | //timing.cpp 2 | unsigned dma_counter(); 3 | unsigned joypad_counter(); 4 | 5 | void add_clocks(unsigned clocks); 6 | void scanline(); 7 | 8 | alwaysinline void alu_edge(); 9 | alwaysinline void dma_edge(); 10 | alwaysinline void last_cycle(); 11 | 12 | void timing_power(); 13 | void timing_reset(); 14 | 15 | //irq.cpp 16 | alwaysinline void poll_nmi(); 17 | alwaysinline void poll_irq(); 18 | void nmitimen_update(uint8 data); 19 | bool rdnmi(); 20 | bool timeup(); 21 | 22 | alwaysinline bool nmi_test(); 23 | alwaysinline bool irq_test(); 24 | 25 | //joypad.cpp 26 | void joypad_edge(); 27 | -------------------------------------------------------------------------------- /bsnes/snes/smp/core/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SMPCORE_CPP 2 | 3 | void SMPcore::core_serialize(serializer &s) { 4 | s.integer(regs.pc); 5 | s.integer(regs.a); 6 | s.integer(regs.x); 7 | s.integer(regs.y); 8 | s.integer(regs.sp); 9 | s.integer(regs.p.n); 10 | s.integer(regs.p.v); 11 | s.integer(regs.p.p); 12 | s.integer(regs.p.b); 13 | s.integer(regs.p.h); 14 | s.integer(regs.p.i); 15 | s.integer(regs.p.z); 16 | s.integer(regs.p.c); 17 | s.integer(regs.wait); 18 | 19 | s.integer(dp); 20 | s.integer(sp); 21 | s.integer(rd); 22 | s.integer(wr); 23 | s.integer(bit); 24 | s.integer(ya); 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /bsnes/ui-qt/settings/profile.moc.hpp: -------------------------------------------------------------------------------- 1 | class ProfileSettingsWindow : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QLabel *profileInfo; 7 | QRadioButton *profileAccuracy; 8 | QLabel *profileAccuracyInfo; 9 | QRadioButton *profileCompatibility; 10 | QLabel *profileCompatibilityInfo; 11 | QRadioButton *profilePerformance; 12 | QLabel *profilePerformanceInfo; 13 | 14 | ProfileSettingsWindow(); 15 | 16 | private slots: 17 | void setAccuracyProfile(); 18 | void setCompatibilityProfile(); 19 | void setPerformanceProfile(); 20 | }; 21 | 22 | extern ProfileSettingsWindow *profileSettingsWindow; 23 | -------------------------------------------------------------------------------- /bsnes/snes/smp/core/core.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define SMPCORE_CPP 5 | namespace SNES { 6 | 7 | #include "serialization.cpp" 8 | #include "algorithms.cpp" 9 | #include "disassembler/disassembler.cpp" 10 | 11 | #define A 0 12 | #define X 1 13 | #define Y 2 14 | #define SP 3 15 | 16 | #include "opcode_mov.cpp" 17 | #include "opcode_pc.cpp" 18 | #include "opcode_read.cpp" 19 | #include "opcode_rmw.cpp" 20 | #include "opcode_misc.cpp" 21 | #include "table.cpp" 22 | 23 | #undef A 24 | #undef X 25 | #undef Y 26 | #undef SP 27 | 28 | SMPcore::SMPcore() { 29 | initialize_opcode_table(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/symbols/symbol_file_adapters.hpp: -------------------------------------------------------------------------------- 1 | class SymbolFileInterface; 2 | 3 | class SymbolFileAdapters { 4 | public: 5 | SymbolFileAdapters(); 6 | 7 | void registerAdapter(SymbolFileInterface*); 8 | 9 | SymbolFileInterface *findBestAdapter(const nall::lstring &rows); 10 | SymbolFileInterface *fetchAdapter(uint32_t requiredFeatures, uint32_t optionalFeatures=0, SymbolFileInterface *current=NULL); 11 | 12 | protected: 13 | uint32_t scoreFeatures(const SymbolFileInterface *adapter, uint32_t requiredFeatures, uint32_t optionalFeatures) const; 14 | 15 | nall::linear_vector adapters; 16 | }; 17 | -------------------------------------------------------------------------------- /bsnes/snes/chip/cx4/bus.hpp: -------------------------------------------------------------------------------- 1 | struct Cx4Bus : Bus { 2 | void init(); 3 | }; 4 | 5 | struct UnmappedCx4 : Memory { 6 | unsigned size() const; 7 | alwaysinline uint8 read(unsigned); 8 | alwaysinline void write(unsigned, uint8); 9 | }; 10 | 11 | struct Cx4ROM : Memory { 12 | unsigned size() const; 13 | alwaysinline uint8 read(unsigned); 14 | alwaysinline void write(unsigned, uint8); 15 | }; 16 | 17 | struct Cx4RAM : Memory { 18 | unsigned size() const; 19 | alwaysinline uint8 read(unsigned); 20 | alwaysinline void write(unsigned, uint8); 21 | }; 22 | 23 | namespace memory { 24 | extern Cx4ROM cx4rom; 25 | extern Cx4RAM cx4ram; 26 | } 27 | -------------------------------------------------------------------------------- /bsnes/ui-qt/settings/bsx.moc.hpp: -------------------------------------------------------------------------------- 1 | class BSXSettingsWindow : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | 7 | QHBoxLayout *timeLayout; 8 | QLabel *timeLabel; 9 | QRadioButton *useLocalTime; 10 | QRadioButton *useCustomTime; 11 | QDateTimeEdit *dateTime; 12 | QLabel *timeNoteLabel; 13 | 14 | QHBoxLayout *sizeLayout; 15 | QLabel *sizeLabel; 16 | QComboBox *sizeCombo; 17 | 18 | void initializeUi(); 19 | BSXSettingsWindow(); 20 | 21 | public slots: 22 | void timeSettingToggled(); 23 | void customTimeSet(); 24 | void defaultSizeSet(); 25 | }; 26 | 27 | extern BSXSettingsWindow *bsxSettingsWindow; 28 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/include/debughandler.h: -------------------------------------------------------------------------------- 1 | #ifndef GAMBATTE_DEBUGHANDLER_H 2 | #define GAMBATTE_DEBUGHANDLER_H 3 | 4 | #include 5 | 6 | namespace gambatte { 7 | 8 | class DebugHandler { 9 | public: 10 | virtual ~DebugHandler() {} 11 | 12 | nall::function op_step; 13 | nall::function op_call; 14 | nall::function op_ret; 15 | nall::function op_irq; 16 | nall::function op_read; 17 | nall::function op_readpc; 18 | nall::function op_write; 19 | }; 20 | 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /bsnes/libco/libco.h: -------------------------------------------------------------------------------- 1 | /* 2 | libco 3 | version: 0.17 (2015-06-18) 4 | author: byuu 5 | license: public domain 6 | */ 7 | 8 | #ifndef LIBCO_H 9 | #define LIBCO_H 10 | 11 | #ifdef LIBCO_C 12 | #ifdef LIBCO_MP 13 | #define thread_local __thread 14 | #else 15 | #define thread_local 16 | #endif 17 | #endif 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef void* cothread_t; 24 | 25 | cothread_t co_active(); 26 | cothread_t co_create(unsigned int, void (*)(void)); 27 | void co_delete(cothread_t); 28 | void co_switch(cothread_t); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | /* ifndef LIBCO_H */ 35 | #endif 36 | -------------------------------------------------------------------------------- /snesreader/7z_C/readme.txt: -------------------------------------------------------------------------------- 1 | Modified LZMA 4.65 2 | ------------------ 3 | This is just the ANSI C 7-zip extraction code from the LZMA 4.65 source 4 | code release, with unnecessary files removed. I've made minor changes to 5 | allow the code to compile with almost all warnings enabled in GCC. 6 | 7 | * Made relevant functions extern "C" so that they can be called from 8 | C++. 9 | 10 | * Put all files in same directory and removed "../../" from #includes. 11 | 12 | * Made private (unprototyped) functions static. 13 | 14 | * #if'd out code that is never called. 15 | 16 | * Removed a couple of Windows references. 17 | 18 | -- 19 | Shay Green 20 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/include/loadres.h: -------------------------------------------------------------------------------- 1 | #ifndef GAMBATTE_LOADRES_H 2 | #define GAMBATTE_LOADRES_H 3 | 4 | #include 5 | 6 | namespace gambatte { 7 | 8 | enum LoadRes { 9 | LOADRES_BAD_FILE_OR_UNKNOWN_MBC = -0x7FFF, 10 | LOADRES_IO_ERROR, 11 | LOADRES_UNSUPPORTED_MBC_HUC3 = -0x1FE, 12 | LOADRES_UNSUPPORTED_MBC_TAMA5, 13 | LOADRES_UNSUPPORTED_MBC_POCKET_CAMERA, 14 | LOADRES_UNSUPPORTED_MBC_MBC7 = -0x122, 15 | LOADRES_UNSUPPORTED_MBC_MBC6 = -0x120, 16 | LOADRES_UNSUPPORTED_MBC_MBC4 = -0x117, 17 | LOADRES_UNSUPPORTED_MBC_MMM01 = -0x10D, 18 | LOADRES_OK = 0 19 | }; 20 | 21 | std::string const to_string(LoadRes); 22 | 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /bsnes/ui-qt/interface.hpp: -------------------------------------------------------------------------------- 1 | class Interface : public SNES::Interface { 2 | public: 3 | void video_extras(uint16_t *data, unsigned width, unsigned height); 4 | void video_refresh(const uint16_t *data, unsigned width, unsigned height); 5 | void audio_sample(uint16_t left, uint16_t right); 6 | void input_poll(); 7 | int16_t input_poll(bool port, SNES::Input::Device device, unsigned index, unsigned id); 8 | void message(const string &text); 9 | 10 | Interface(); 11 | void captureScreenshot(const QImage&); 12 | void captureSPC(); 13 | bool saveScreenshot; 14 | bool framesUpdated; 15 | unsigned framesExecuted; 16 | }; 17 | 18 | extern Interface intf; 19 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/ppu/tile-renderer.hpp: -------------------------------------------------------------------------------- 1 | struct TileRenderer : public BaseRenderer { 2 | enum Source { VRAM, CPU_BUS, CART_ROM, CART_RAM, SA1_BUS, SFX_BUS }; 3 | 4 | Source source; 5 | unsigned address; 6 | 7 | unsigned width; 8 | 9 | unsigned paletteOffset; 10 | bool useCgramPalette; 11 | 12 | public: 13 | TileRenderer(); 14 | 15 | unsigned addressMask() const; 16 | unsigned nTiles() const; 17 | unsigned maxAddress() const; 18 | 19 | void draw(); 20 | 21 | private: 22 | void buildCgramPalette(); 23 | void buildBlackWhitePalette(); 24 | 25 | void drawVramTileset(); 26 | void drawMode7Tileset(); 27 | void drawMemorySourceTiles(); 28 | }; 29 | -------------------------------------------------------------------------------- /snesfilter/direct/direct.cpp: -------------------------------------------------------------------------------- 1 | #include "direct.hpp" 2 | 3 | void DirectFilter::size(unsigned &outwidth, unsigned &outheight, unsigned width, unsigned height) { 4 | outwidth = width; 5 | outheight = height; 6 | } 7 | 8 | void DirectFilter::render( 9 | uint32_t *output, unsigned outpitch, const uint16_t *input, unsigned pitch, 10 | unsigned width, unsigned height 11 | ) { 12 | pitch >>= 1; 13 | outpitch >>= 2; 14 | 15 | for(unsigned y = 0; y < height; y++) { 16 | for(unsigned x = 0; x < width; x++) { 17 | uint16_t p = *input++; 18 | *output++ = colortable[p]; 19 | } 20 | input += pitch - width; 21 | output += outpitch - width; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /snesreader/7z_C/7zBuf.c: -------------------------------------------------------------------------------- 1 | /* 7zBuf.c -- Byte Buffer 2 | 2008-03-28 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "7zBuf.h" 7 | 8 | void Buf_Init(CBuf *p) 9 | { 10 | p->data = 0; 11 | p->size = 0; 12 | } 13 | 14 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc) 15 | { 16 | p->size = 0; 17 | if (size == 0) 18 | { 19 | p->data = 0; 20 | return 1; 21 | } 22 | p->data = (Byte *)alloc->Alloc(alloc, size); 23 | if (p->data != 0) 24 | { 25 | p->size = size; 26 | return 1; 27 | } 28 | return 0; 29 | } 30 | 31 | void Buf_Free(CBuf *p, ISzAlloc *alloc) 32 | { 33 | alloc->Free(alloc, p->data); 34 | p->data = 0; 35 | p->size = 0; 36 | } 37 | -------------------------------------------------------------------------------- /snesreader/fex/Binary_Extractor.h: -------------------------------------------------------------------------------- 1 | // Presents a single file as an "archive" of just that file. 2 | 3 | // File_Extractor 1.0.0 4 | #ifndef BINARY_EXTRACTOR_H 5 | #define BINARY_EXTRACTOR_H 6 | 7 | #include "File_Extractor.h" 8 | 9 | class Binary_Extractor : public File_Extractor { 10 | public: 11 | Binary_Extractor(); 12 | virtual ~Binary_Extractor(); 13 | 14 | protected: 15 | virtual blargg_err_t open_path_v(); 16 | virtual blargg_err_t open_v(); 17 | virtual void close_v(); 18 | 19 | virtual blargg_err_t next_v(); 20 | virtual blargg_err_t rewind_v(); 21 | 22 | virtual blargg_err_t stat_v(); 23 | virtual blargg_err_t extract_v( void*, int ); 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/symbols/adapters/wla_symbol_file.hpp: -------------------------------------------------------------------------------- 1 | #include "symbol_file_interface.hpp" 2 | 3 | class SymbolMap; 4 | 5 | class WlaSymbolFile : public SymbolFileInterface { 6 | public: 7 | WlaSymbolFile() {} 8 | virtual ~WlaSymbolFile() {} 9 | 10 | const char *getName() const; 11 | const char *getDescription() const; 12 | 13 | int32_t scoreReadString(const nall::lstring &rows) const; 14 | bool read(const nall::lstring &rows, SymbolMap *map) const; 15 | 16 | nall::string filteredRow(const nall::string &input) const; 17 | 18 | bool write(nall::file &file, SymbolMap *map) const; 19 | 20 | uint32_t getFeatures() const; 21 | 22 | protected: 23 | string writeAddress(uint32_t address) const; 24 | }; 25 | -------------------------------------------------------------------------------- /snesreader/7z_C/7zCrc.h: -------------------------------------------------------------------------------- 1 | /* 7zCrc.h -- CRC32 calculation 2 | 2009-11-21 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_CRC_H 5 | #define __7Z_CRC_H 6 | 7 | #include "Types.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | extern UInt32 g_CrcTable[]; 12 | 13 | /* Call CrcGenerateTable one time before other CRC functions */ 14 | void MY_FAST_CALL CrcGenerateTable(void); 15 | 16 | #define CRC_INIT_VAL 0xFFFFFFFF 17 | #define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL) 18 | #define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 19 | 20 | UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size); 21 | UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size); 22 | 23 | EXTERN_C_END 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /bsnes/ui-qt/platform/platform_win.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | bool Application::App::winEventFilter(MSG *msg, long *result) { 4 | //supress screen saver from activating during gameplay 5 | if(msg->message == WM_SYSCOMMAND) { 6 | WPARAM wParam = msg->wParam & 0xFFF0; 7 | 8 | if(wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER) { 9 | *result = 0; 10 | return true; 11 | } 12 | } 13 | 14 | //prevent DirectSound audio buffer from looping during Windows modal events 15 | if(msg->message == WM_ENTERMENULOOP || msg->message == WM_ENTERSIZEMOVE) { 16 | audio.clear(); 17 | } 18 | 19 | return false; 20 | } 21 | 22 | void supressScreenSaver() { 23 | //handled by event filter above 24 | } 25 | 26 | -------------------------------------------------------------------------------- /bsnes/snes/chip/sa1/memory/memory.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SA1_CPP 2 | 3 | //ROM, I-RAM and MMIO registers are accessed at ~10.74MHz (2 clock ticks) 4 | //BW-RAM is accessed at ~5.37MHz (4 clock ticks) 5 | //tick() == 2 clock ticks 6 | //note: bus conflict delays are not emulated at this time 7 | 8 | void SA1::op_io() { 9 | tick(); 10 | } 11 | 12 | uint8 SA1::op_read(unsigned addr) { 13 | tick(); 14 | if(((addr & 0x40e000) == 0x006000) || ((addr & 0xd00000) == 0x400000)) tick(); 15 | return regs.mdr = sa1bus.read(addr); 16 | } 17 | 18 | void SA1::op_write(unsigned addr, uint8 data) { 19 | tick(); 20 | if(((addr & 0x40e000) == 0x006000) || ((addr & 0xd00000) == 0x400000)) tick(); 21 | sa1bus.write(addr, regs.mdr = data); 22 | } 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /bsnes/snes/alt/dsp/blargg_config.h: -------------------------------------------------------------------------------- 1 | // snes_spc 0.9.0 user configuration file. Don't replace when updating library. 2 | 3 | // snes_spc 0.9.0 4 | #ifndef BLARGG_CONFIG_H 5 | #define BLARGG_CONFIG_H 6 | 7 | // Uncomment to disable debugging checks 8 | //#define NDEBUG 1 9 | 10 | // Uncomment to enable platform-specific (and possibly non-portable) optimizations 11 | //#define BLARGG_NONPORTABLE 1 12 | 13 | // Uncomment if automatic byte-order determination doesn't work 14 | //#define BLARGG_BIG_ENDIAN 1 15 | 16 | // Uncomment if you get errors in the bool section of blargg_common.h 17 | //#define BLARGG_COMPILER_HAS_BOOL 1 18 | 19 | // Use standard config.h if present 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /bsnes/ruby/audio.hpp: -------------------------------------------------------------------------------- 1 | class Audio { 2 | public: 3 | static const char *Volume; 4 | static const char *Resample; 5 | static const char *ResampleRatio; 6 | 7 | static const char *Handle; 8 | static const char *Synchronize; 9 | static const char *Frequency; 10 | static const char *Latency; 11 | 12 | virtual bool cap(const nall::string& name) { return false; } 13 | virtual nall::any get(const nall::string& name) { return false; } 14 | virtual bool set(const nall::string& name, const nall::any& value) { return false; } 15 | 16 | virtual void sample(uint16_t left, uint16_t right) {} 17 | virtual void clear() {} 18 | virtual bool init() { return true; } 19 | virtual void term() {} 20 | 21 | Audio() {} 22 | virtual ~Audio() {} 23 | }; 24 | -------------------------------------------------------------------------------- /bsnes/ui-qt/base/htmlviewer.cpp: -------------------------------------------------------------------------------- 1 | #include "htmlviewer.moc" 2 | HtmlViewerWindow *htmlViewerWindow; 3 | 4 | HtmlViewerWindow::HtmlViewerWindow() { 5 | setObjectName("html-window"); 6 | resize(560, 480); 7 | setGeometryString(&config().geometry.htmlViewerWindow); 8 | application.windowList.append(this); 9 | 10 | layout = new QVBoxLayout; 11 | layout->setMargin(Style::WindowMargin); 12 | layout->setSpacing(0); 13 | setLayout(layout); 14 | 15 | document = new QTextBrowser; 16 | document->setOpenExternalLinks(true); 17 | layout->addWidget(document); 18 | } 19 | 20 | void HtmlViewerWindow::show(const char *title, const char *htmlData) { 21 | document->setHtml(string() << htmlData); 22 | setWindowTitle(title); 23 | Window::show(); 24 | } 25 | -------------------------------------------------------------------------------- /bsnes/data/bsnes.Manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | true 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /bsnes/snes/smp/core/memory.hpp: -------------------------------------------------------------------------------- 1 | debugvirtual alwaysinline uint8_t op_readpc() { 2 | return op_read(regs.pc++); 3 | } 4 | 5 | alwaysinline uint8_t op_readstack() { 6 | return op_read(0x0100 | ++regs.sp); 7 | } 8 | 9 | alwaysinline void op_writestack(uint8_t data) { 10 | op_write(0x0100 | regs.sp--, data); 11 | } 12 | 13 | alwaysinline uint8_t op_readaddr(uint16_t addr) { 14 | return op_read(addr); 15 | } 16 | 17 | alwaysinline void op_writeaddr(uint16_t addr, uint8_t data) { 18 | op_write(addr, data); 19 | } 20 | 21 | alwaysinline uint8_t op_readdp(uint8_t addr) { 22 | return op_read(((unsigned)regs.p.p << 8) + addr); 23 | } 24 | 25 | alwaysinline void op_writedp(uint8_t addr, uint8_t data) { 26 | op_write(((unsigned)regs.p.p << 8) + addr, data); 27 | } 28 | -------------------------------------------------------------------------------- /bsnes/ruby/input.hpp: -------------------------------------------------------------------------------- 1 | class Input { 2 | public: 3 | static const char *Handle; 4 | static const char *KeyboardSupport; 5 | static const char *MouseSupport; 6 | static const char *JoypadSupport; 7 | 8 | virtual bool cap(const nall::string& name) { return false; } 9 | virtual nall::any get(const nall::string& name) { return false; } 10 | virtual bool set(const nall::string& name, const nall::any& value) { return false; } 11 | 12 | virtual bool acquire() { return false; } 13 | virtual bool unacquire() { return false; } 14 | virtual bool acquired() { return false; } 15 | 16 | virtual bool poll(int16_t *table) { return false; } 17 | virtual bool init() { return true; } 18 | virtual void term() {} 19 | 20 | Input() {} 21 | virtual ~Input() {} 22 | }; 23 | -------------------------------------------------------------------------------- /bsnes/ui-qt/settings/audio.moc.hpp: -------------------------------------------------------------------------------- 1 | class AudioSettingsWindow : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QHBoxLayout *boxes; 7 | QLabel *frequencyLabel; 8 | QComboBox *frequency; 9 | QLabel *latencyLabel; 10 | QComboBox *latency; 11 | QGridLayout *sliders; 12 | QLabel *volumeLabel; 13 | QLabel *volumeValue; 14 | QSlider *volume; 15 | QLabel *frequencySkewLabel; 16 | QLabel *frequencySkewValue; 17 | QSlider *frequencySkew; 18 | 19 | void syncUi(); 20 | AudioSettingsWindow(); 21 | 22 | public slots: 23 | void frequencyChange(int value); 24 | void latencyChange(int value); 25 | void volumeAdjust(int value); 26 | void frequencySkewAdjust(int value); 27 | }; 28 | 29 | extern AudioSettingsWindow *audioSettingsWindow; 30 | -------------------------------------------------------------------------------- /bsnes/snes/chip/serial/serial.hpp: -------------------------------------------------------------------------------- 1 | class Serial : public Coprocessor, public MMIO, public library, public property { 2 | public: 3 | static void Enter(); 4 | void enter(); 5 | void init(); 6 | void enable(); 7 | void power(); 8 | void reset(); 9 | void serialize(serializer&); 10 | 11 | readonly data1; 12 | readonly data2; 13 | 14 | void add_clocks(unsigned clocks); 15 | uint8 read(); 16 | void write(uint8 data); 17 | 18 | uint8 mmio_read(unsigned addr); 19 | void mmio_write(unsigned addr, uint8 data); 20 | 21 | private: 22 | MMIO *r4016, *r4017; 23 | function baudrate; 24 | function flowcontrol; 25 | function main; 26 | }; 27 | 28 | extern Serial serial; 29 | -------------------------------------------------------------------------------- /bsnes/snes/chip/superfx/superfx.hpp: -------------------------------------------------------------------------------- 1 | #include "bus/bus.hpp" 2 | 3 | class SuperFX : public Coprocessor, public MMIO { 4 | public: 5 | #include "core/core.hpp" 6 | #include "memory/memory.hpp" 7 | #include "mmio/mmio.hpp" 8 | #include "timing/timing.hpp" 9 | #include "disasm/disasm.hpp" 10 | 11 | static void Enter(); 12 | void enter(); 13 | void init(); 14 | void enable(); 15 | void power(); 16 | debugvirtual void reset(); 17 | void serialize(serializer&); 18 | 19 | // used by the superfx debugger prior to executing instructions 20 | debugvirtual void op_step() {}; 21 | }; 22 | 23 | #if defined(DEBUGGER) 24 | #include "debugger/debugger.hpp" 25 | extern SFXDebugger superfx; 26 | #else 27 | extern SuperFX superfx; 28 | #endif 29 | extern SuperFXBus superfxbus; 30 | -------------------------------------------------------------------------------- /bsnes/ui-qt/link/music.hpp: -------------------------------------------------------------------------------- 1 | class Music : public library { 2 | public: 3 | string extensionList; 4 | 5 | function supported; 6 | function unload; 7 | function loaded; 8 | function load_spc; 9 | function load_snsf; 10 | function render; 11 | 12 | const char* default_supported(); 13 | void default_unload(); 14 | bool default_loaded(); 15 | bool default_load_spc(string&, uint8_t*&, uint16_t&, uint8_t(&)[4], uint8_t&); 16 | bool default_load_snsf(string&, uint8_t*&, unsigned&); 17 | void default_render(uint16_t*, unsigned, unsigned, unsigned); 18 | 19 | Music(); 20 | }; 21 | 22 | extern Music music; 23 | -------------------------------------------------------------------------------- /bsnes/snes/scheduler/scheduler.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SYSTEM_CPP 2 | 3 | Scheduler scheduler; 4 | 5 | void Scheduler::enter() { 6 | host_thread = co_active(); 7 | co_switch(thread); 8 | } 9 | 10 | void Scheduler::exit(ExitReason reason) { 11 | exit_reason = reason; 12 | thread = co_active(); 13 | co_switch(host_thread); 14 | } 15 | 16 | void Scheduler::resume(cothread_t& thread) { 17 | if (mode == Mode::Synchronize) 18 | desynchronized = true; 19 | co_switch(thread); 20 | } 21 | 22 | void Scheduler::init() { 23 | host_thread = co_active(); 24 | thread = cpu.thread; 25 | desynchronized = false; 26 | mode = Mode::Synchronize; 27 | } 28 | 29 | Scheduler::Scheduler() { 30 | host_thread = 0; 31 | thread = 0; 32 | desynchronized = false; 33 | exit_reason = ExitReason::UnknownEvent; 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /bsnes/snes/chip/superfx/bus/bus.hpp: -------------------------------------------------------------------------------- 1 | struct SuperFXBus : Bus { 2 | void init(); 3 | }; 4 | 5 | struct SuperFXGSUROM : Memory { 6 | unsigned size() const; 7 | uint8 read(unsigned); 8 | void write(unsigned, uint8); 9 | }; 10 | 11 | struct SuperFXGSURAM : Memory { 12 | unsigned size() const; 13 | uint8 read(unsigned); 14 | void write(unsigned, uint8); 15 | }; 16 | 17 | struct SuperFXCPUROM : Memory { 18 | unsigned size() const; 19 | uint8 read(unsigned); 20 | void write(unsigned, uint8); 21 | }; 22 | 23 | struct SuperFXCPURAM : Memory { 24 | unsigned size() const; 25 | uint8 read(unsigned); 26 | void write(unsigned, uint8); 27 | }; 28 | 29 | namespace memory { 30 | extern SuperFXGSUROM gsurom; 31 | extern SuperFXGSURAM gsuram; 32 | extern SuperFXCPUROM fxrom; 33 | extern SuperFXCPURAM fxram; 34 | } 35 | -------------------------------------------------------------------------------- /bsnes/ui-qt/tools/manifestviewer.cpp: -------------------------------------------------------------------------------- 1 | #include "manifestviewer.moc" 2 | ManifestViewerWindow *manifestViewerWindow; 3 | 4 | ManifestViewerWindow::ManifestViewerWindow() { 5 | layout = new QVBoxLayout; 6 | layout->setAlignment(Qt::AlignTop | Qt::AlignLeft); 7 | layout->setMargin(Style::WindowMargin); 8 | layout->setSpacing(Style::WidgetSpacing); 9 | setLayout(layout); 10 | 11 | textEdit = new QPlainTextEdit; 12 | textEdit->setReadOnly(true); 13 | textEdit->setFont(QFont(Style::Monospace)); 14 | textEdit->setLineWrapMode(QPlainTextEdit::NoWrap); 15 | layout->addWidget(textEdit); 16 | 17 | synchronize(); 18 | } 19 | 20 | void ManifestViewerWindow::synchronize() { 21 | if (SNES::cartridge.loaded()) 22 | textEdit->setPlainText(cartridge.baseXml); 23 | else 24 | textEdit->setPlainText("No cartridge loaded."); 25 | } 26 | -------------------------------------------------------------------------------- /bsnes/snes/alt/ppu/render/addsub.cpp: -------------------------------------------------------------------------------- 1 | #ifdef PPU_CPP 2 | 3 | //color addition / subtraction 4 | //thanks go to blargg for the optimized algorithms 5 | inline uint16 PPU::addsub(uint32 x, uint32 y, bool halve) { 6 | if(!regs.color_mode) { 7 | if(!halve) { 8 | unsigned sum = x + y; 9 | unsigned carry = (sum - ((x ^ y) & 0x0421)) & 0x8420; 10 | return (sum - carry) | (carry - (carry >> 5)); 11 | } else { 12 | return (x + y - ((x ^ y) & 0x0421)) >> 1; 13 | } 14 | } else { 15 | unsigned diff = x - y + 0x8420; 16 | unsigned borrow = (diff - ((x ^ y) & 0x8420)) & 0x8420; 17 | if(!halve) { 18 | return (diff - borrow) & (borrow - (borrow >> 5)); 19 | } else { 20 | return (((diff - borrow) & (borrow - (borrow >> 5))) & 0x7bde) >> 1; 21 | } 22 | } 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /bsnes/Snesida/snesida.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(OutDir) 5 | WindowsLocalDebugger 6 | c:\Program Files\IDA Pro 7.6\ida.exe 7 | 8 | 9 | WindowsLocalDebugger 10 | c:\Program Files\IDA Pro 7.6\ida.exe 11 | $(OutDir) 12 | 13 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/ppu/cgram-widget.moc.hpp: -------------------------------------------------------------------------------- 1 | class CgramWidget : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | CgramWidget(); 6 | void paintEvent(QPaintEvent*); 7 | void mousePressEvent(QMouseEvent*); 8 | 9 | void setScale(unsigned); 10 | 11 | void setPaletteBpp(unsigned); 12 | void setPaletteSize(unsigned); 13 | 14 | bool hasSelected() const; 15 | unsigned selectedPalette() const; 16 | 17 | unsigned selectedColor() const; 18 | 19 | void selectNone(); 20 | void setSelected(int); 21 | 22 | public slots: 23 | void refresh(); 24 | 25 | signals: 26 | void selectedChanged(); 27 | 28 | private: 29 | QImage *image; 30 | int selected; 31 | 32 | unsigned scale; 33 | unsigned selectedMask; 34 | unsigned selectedWidth; 35 | unsigned selectedHeight; 36 | }; 37 | 38 | QRgb rgbFromCgram(unsigned); 39 | -------------------------------------------------------------------------------- /common/nall/detect.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_DETECT_HPP 2 | #define NALL_DETECT_HPP 3 | 4 | /* Compiler detection */ 5 | 6 | #if defined(__GNUC__) 7 | #define COMPILER_GCC 8 | #elif defined(_MSC_VER) 9 | #define COMPILER_VISUALC 10 | #endif 11 | 12 | /* Platform detection */ 13 | 14 | #if defined(_WIN32) 15 | #define PLATFORM_WIN 16 | #elif defined(__APPLE__) 17 | #define PLATFORM_OSX 18 | #elif defined(linux) || defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 19 | #define PLATFORM_X 20 | #endif 21 | 22 | /* Endian detection */ 23 | 24 | #if defined(__i386__) || defined(__amd64__) || defined(_M_IX86) || defined(_M_AMD64) 25 | #define ARCH_LSB 26 | #elif defined(__powerpc__) || defined(_M_PPC) || defined(__BIG_ENDIAN__) 27 | #define ARCH_MSB 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /snesreader/7z_C/7zBuf.h: -------------------------------------------------------------------------------- 1 | /* 7zBuf.h -- Byte Buffer 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_BUF_H 5 | #define __7Z_BUF_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | typedef struct 14 | { 15 | Byte *data; 16 | size_t size; 17 | } CBuf; 18 | 19 | void Buf_Init(CBuf *p); 20 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); 21 | void Buf_Free(CBuf *p, ISzAlloc *alloc); 22 | 23 | typedef struct 24 | { 25 | Byte *data; 26 | size_t size; 27 | size_t pos; 28 | } CDynBuf; 29 | 30 | void DynBuf_Construct(CDynBuf *p); 31 | void DynBuf_SeekToBeg(CDynBuf *p); 32 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc); 33 | void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /bsnes/snes/cheat/cheat.hpp: -------------------------------------------------------------------------------- 1 | struct CheatCode { 2 | bool enabled; 3 | array addr; 4 | array data; 5 | 6 | bool operator=(string); 7 | CheatCode(); 8 | }; 9 | 10 | class Cheat : public linear_vector { 11 | public: 12 | enum class Type : unsigned { ProActionReplay, GameGenie }; 13 | 14 | bool enabled() const; 15 | void enable(bool); 16 | void synchronize(); 17 | bool read(unsigned, uint8&, Bus&) const; 18 | 19 | inline bool active() const; 20 | inline bool exists(uint16 addr) const; 21 | 22 | Cheat(); 23 | 24 | static bool decode(const char*, unsigned&, uint8&, Type&); 25 | static bool encode(string&, unsigned, uint8, Type); 26 | 27 | private: 28 | uint8 bitmask[0x2000]; 29 | bool system_enabled; 30 | bool code_enabled; 31 | bool cheat_enabled; 32 | }; 33 | 34 | extern Cheat cheat; 35 | -------------------------------------------------------------------------------- /bsnes/snes/chip/chip.hpp: -------------------------------------------------------------------------------- 1 | struct Coprocessor : Processor { 2 | alwaysinline void step(unsigned clocks); 3 | alwaysinline void synchronize_cpu(); 4 | }; 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | void Coprocessor::step(unsigned clocks) { 21 | clock += clocks * (uint64)cpu.frequency; 22 | } 23 | 24 | void Coprocessor::synchronize_cpu() { 25 | if(clock >= 0) scheduler.resume(cpu.thread); 26 | } 27 | -------------------------------------------------------------------------------- /bsnes/snes/cpu/core/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef CPUCORE_CPP 2 | 3 | void CPUcore::core_serialize(serializer &s) { 4 | s.integer(regs.pc.d); 5 | 6 | s.integer(regs.a.w); 7 | s.integer(regs.x.w); 8 | s.integer(regs.y.w); 9 | s.integer(regs.z.w); 10 | s.integer(regs.s.w); 11 | s.integer(regs.d.w); 12 | 13 | s.integer(regs.p.n); 14 | s.integer(regs.p.v); 15 | s.integer(regs.p.m); 16 | s.integer(regs.p.x); 17 | s.integer(regs.p.d); 18 | s.integer(regs.p.i); 19 | s.integer(regs.p.z); 20 | s.integer(regs.p.c); 21 | 22 | s.integer(regs.db); 23 | s.integer(regs.e); 24 | s.integer(regs.irq); 25 | s.integer(regs.wai); 26 | s.integer(regs.stp); 27 | s.integer(regs.mdr); 28 | 29 | s.integer(aa.d); 30 | s.integer(rd.d); 31 | s.integer(sp); 32 | s.integer(dp); 33 | 34 | update_table(); 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /bsnes/snes/cpu/debugger/analyst.hpp: -------------------------------------------------------------------------------- 1 | struct CPUAnalystState { 2 | CPUAnalystState(bool e=true, bool m=true, bool x=true) : e(e), m(m), x(x), bank(0) {} 3 | 4 | inline unsigned char mask() const { 5 | return 6 | (e ? CPUDebugger::UsageFlagE : 0) 7 | | (m ? CPUDebugger::UsageFlagM : 0) 8 | | (x ? CPUDebugger::UsageFlagX : 0) 9 | ; 10 | } 11 | 12 | unsigned char bank; 13 | bool e; 14 | bool m; 15 | bool x; 16 | }; 17 | 18 | class CPUAnalyst { 19 | public: 20 | CPUAnalyst(CPUcore &_core, uint8_t *_usage) : core(_core), usage(_usage) {} 21 | void performFullAnalysis(); 22 | void performAnalysisForVector(uint32_t address, bool emulation=false); 23 | uint32_t performAnalysis(uint32_t address, CPUAnalystState &state, bool force=false); 24 | 25 | private: 26 | CPUcore &core; 27 | uint8_t *usage; 28 | }; 29 | -------------------------------------------------------------------------------- /supergameboy/common/scoped_ptr.h: -------------------------------------------------------------------------------- 1 | #ifndef SCOPED_PTR_H 2 | #define SCOPED_PTR_H 3 | 4 | #include "transfer_ptr.h" 5 | #include "uncopyable.h" 6 | 7 | template 8 | class scoped_ptr : Uncopyable { 9 | public: 10 | explicit scoped_ptr(T *p = 0) : p_(p) {} 11 | template explicit scoped_ptr(transfer_ptr p) : p_(p.release()) {} 12 | ~scoped_ptr() { Deleter::del(p_); } 13 | T * get() const { return p_; } 14 | void reset(T *p = 0) { Deleter::del(p_); p_ = p; } 15 | T & operator*() const { return *p_; } 16 | T * operator->() const { return p_; } 17 | operator bool() const { return p_; } 18 | 19 | template 20 | scoped_ptr & operator=(transfer_ptr p) { 21 | reset(p.release()); 22 | return *this; 23 | } 24 | 25 | private: 26 | T *p_; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /snesreader/fex/Gzip_Extractor.h: -------------------------------------------------------------------------------- 1 | // Presents a gzipped file as an "archive" of just that file. 2 | // Also handles non-gzipped files. 3 | 4 | // File_Extractor 1.0.0 5 | #ifndef GZIP_EXTRACTOR_H 6 | #define GZIP_EXTRACTOR_H 7 | 8 | #include "File_Extractor.h" 9 | #include "Gzip_Reader.h" 10 | 11 | class Gzip_Extractor : public File_Extractor { 12 | public: 13 | Gzip_Extractor(); 14 | virtual ~Gzip_Extractor(); 15 | 16 | protected: 17 | virtual blargg_err_t open_path_v(); 18 | virtual blargg_err_t open_v(); 19 | virtual void close_v(); 20 | 21 | virtual blargg_err_t next_v(); 22 | virtual blargg_err_t rewind_v(); 23 | 24 | virtual blargg_err_t stat_v(); 25 | virtual blargg_err_t extract_v( void*, int ); 26 | 27 | private: 28 | Gzip_Reader gr; 29 | blargg_vector name; 30 | 31 | void set_info_(); 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /bsnes/ui-qt/tools/tools.moc.hpp: -------------------------------------------------------------------------------- 1 | class ToolsWindow : public Window { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QTabWidget *tab; 7 | QScrollArea *cheatEditorArea; 8 | QScrollArea *cheatFinderArea; 9 | QScrollArea *stateManagerArea; 10 | QScrollArea *effectToggleArea; 11 | QScrollArea *manifestViewerArea; 12 | 13 | ToolsWindow(); 14 | 15 | public slots: 16 | void showCheatEditor() { tab->setCurrentWidget(cheatEditorArea); show(); } 17 | void showCheatFinder() { tab->setCurrentWidget(cheatFinderArea); show(); } 18 | void showStateManager() { tab->setCurrentWidget(stateManagerArea); show(); } 19 | void showEffectToggle() { tab->setCurrentWidget(effectToggleArea); show(); } 20 | void showManifestViewer() { tab->setCurrentWidget(manifestViewerArea); show(); } 21 | }; 22 | 23 | extern ToolsWindow *toolsWindow; 24 | -------------------------------------------------------------------------------- /bsnes/snes/alt/dsp/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef DSP_CPP 2 | 3 | static void dsp_state_save(unsigned char **out, void *in, size_t size) { 4 | memcpy(*out, in, size); 5 | *out += size; 6 | } 7 | 8 | static void dsp_state_load(unsigned char **in, void *out, size_t size) { 9 | memcpy(out, *in, size); 10 | *in += size; 11 | } 12 | 13 | void DSP::serialize(serializer &s) { 14 | Processor::serialize(s); 15 | s.array(samplebuffer); 16 | 17 | unsigned char state[SPC_DSP::state_size]; 18 | unsigned char *p = state; 19 | memset(&state, 0, SPC_DSP::state_size); 20 | if(s.mode() == serializer::Save) { 21 | spc_dsp.copy_state(&p, dsp_state_save); 22 | s.array(state); 23 | } else if(s.mode() == serializer::Load) { 24 | s.array(state); 25 | spc_dsp.copy_state(&p, dsp_state_load); 26 | } else { 27 | s.array(state); 28 | } 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /supergameboy/common/transfer_ptr.h: -------------------------------------------------------------------------------- 1 | #ifndef TRANSFER_PTR_H 2 | #define TRANSFER_PTR_H 3 | 4 | #include "defined_ptr.h" 5 | 6 | template 7 | class transfer_ptr { 8 | private: 9 | struct released { T *p; explicit released(T *p) : p(p) {} }; 10 | public: 11 | explicit transfer_ptr(T *p = 0) : p_(p) {} 12 | transfer_ptr(transfer_ptr &p) : p_(p.release()) {} 13 | transfer_ptr(released r) : p_(r.p) {} 14 | ~transfer_ptr() { Deleter::del(p_); } 15 | T * get() const { return p_; } 16 | T * release() { T *p = p_; p_ = 0; return p; } 17 | operator released const () { return released(release()); } 18 | T & operator*() const { return *p_; } 19 | T * operator->() const { return p_; } 20 | operator bool() const { return p_; } 21 | 22 | private: 23 | T *p_; 24 | transfer_ptr & operator=(transfer_ptr const &); 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/video/lcddef.h: -------------------------------------------------------------------------------- 1 | #ifndef LCDDEF_H 2 | #define LCDDEF_H 3 | 4 | namespace gambatte { 5 | 6 | enum { 7 | lcdc_bgen = 0x01, 8 | lcdc_objen = 0x02, 9 | lcdc_obj2x = 0x04, 10 | lcdc_bgtmsel = 0x08, 11 | lcdc_tdsel = 0x10, 12 | lcdc_we = 0x20, 13 | lcdc_wtmsel = 0x40, 14 | lcdc_en = 0x80 }; 15 | 16 | enum { 17 | lcdstat_lycflag = 0x04, 18 | lcdstat_m0irqen = 0x08, 19 | lcdstat_m1irqen = 0x10, 20 | lcdstat_m2irqen = 0x20, 21 | lcdstat_lycirqen = 0x40 }; 22 | 23 | enum { 24 | lcd_hres = 160, 25 | lcd_vres = 144, 26 | lcd_lines_per_frame = 154, 27 | lcd_max_num_sprites_per_line = 10, 28 | lcd_num_oam_entries = 40, 29 | lcd_cycles_per_line = 456, 30 | lcd_force_signed_enum1 = -1 }; 31 | enum { 32 | lcd_cycles_per_frame = 1l * lcd_lines_per_frame * lcd_cycles_per_line, 33 | lcd_force_signed_enum2 = -1 }; 34 | 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/processor/processor.hpp: -------------------------------------------------------------------------------- 1 | #include "../line.hpp" 2 | 3 | class DisasmProcessor { 4 | public: 5 | virtual uint32_t getBusSize() = 0; 6 | virtual uint32_t getCurrentAddress() = 0; 7 | 8 | virtual class SymbolMap *getSymbols() = 0; 9 | 10 | virtual uint32_t findStartLineAddress(uint32_t currentAddress, uint32_t linesBelow) = 0; 11 | virtual void findKnownRange(uint32_t currentAddress, uint32_t &startAddress, uint32_t &endAddress, uint32_t ¤tAddressLine, uint32_t &numLines) = 0; 12 | virtual void analyze(uint32_t address) {} 13 | virtual bool getLine(DisassemblerLine &result, uint32_t &address) = 0; 14 | 15 | virtual uint8_t usage(uint32_t address) = 0; 16 | virtual uint8_t read(uint32_t address) = 0; 17 | virtual void write(uint32_t address, uint8_t data) = 0; 18 | 19 | virtual string getBreakpointBusName() = 0; 20 | }; 21 | -------------------------------------------------------------------------------- /bsnes/snes/alt/cpu/memory.cpp: -------------------------------------------------------------------------------- 1 | #ifdef CPU_CPP 2 | 3 | uint8 CPU::pio() { 4 | return status.pio; 5 | } 6 | 7 | bool CPU::joylatch() { 8 | return status.joypad_strobe_latch; 9 | } 10 | 11 | bool CPU::interrupt_pending() { 12 | return false; 13 | } 14 | 15 | void CPU::op_io() { 16 | add_clocks(6); 17 | } 18 | 19 | uint8 CPU::op_read(unsigned addr) { 20 | regs.mdr = bus.read(addr); 21 | add_clocks(speed(addr)); 22 | return regs.mdr; 23 | } 24 | 25 | void CPU::op_write(unsigned addr, uint8 data) { 26 | add_clocks(speed(addr)); 27 | bus.write(addr, regs.mdr = data); 28 | } 29 | 30 | unsigned CPU::speed(unsigned addr) const { 31 | if(addr & 0x408000) { 32 | if(addr & 0x800000) return status.rom_speed; 33 | return 8; 34 | } 35 | if((addr + 0x6000) & 0x4000) return 8; 36 | if((addr - 0x4000) & 0x7e00) return 6; 37 | return 12; 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /bsnes/snes/dsp/misc.cpp: -------------------------------------------------------------------------------- 1 | #ifdef DSP_CPP 2 | 3 | void DSP::misc_27() { 4 | state.t_pmon = REG(pmon) & ~1; //voice 0 doesn't support PMON 5 | } 6 | 7 | void DSP::misc_28() { 8 | state.t_non = REG(non); 9 | state.t_eon = REG(eon); 10 | state.t_dir = REG(dir); 11 | } 12 | 13 | void DSP::misc_29() { 14 | state.every_other_sample ^= 1; 15 | if(state.every_other_sample) { 16 | state.new_kon &= ~state.kon; //clears KON 63 clocks after it was last read 17 | } 18 | } 19 | 20 | void DSP::misc_30() { 21 | if(state.every_other_sample) { 22 | state.kon = state.new_kon; 23 | state.t_koff = REG(koff); 24 | } 25 | 26 | counter_tick(); 27 | 28 | //noise 29 | if(counter_poll(REG(flg) & 0x1f) == true) { 30 | int feedback = (state.noise << 13) ^ (state.noise << 14); 31 | state.noise = (feedback & 0x4000) ^ (state.noise >> 1); 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /snesreader/7z_C/Bcj2.h: -------------------------------------------------------------------------------- 1 | /* Bcj2.h -- Converter for x86 code (BCJ2) 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BCJ2_H 5 | #define __BCJ2_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /* 14 | Conditions: 15 | outSize <= FullOutputSize, 16 | where FullOutputSize is full size of output stream of x86_2 filter. 17 | 18 | If buf0 overlaps outBuf, there are two required conditions: 19 | 1) (buf0 >= outBuf) 20 | 2) (buf0 + size0 >= outBuf + FullOutputSize). 21 | 22 | Returns: 23 | SZ_OK 24 | SZ_ERROR_DATA - Data error 25 | */ 26 | 27 | int Bcj2_Decode( 28 | const Byte *buf0, SizeT size0, 29 | const Byte *buf1, SizeT size1, 30 | const Byte *buf2, SizeT size2, 31 | const Byte *buf3, SizeT size3, 32 | Byte *outBuf, SizeT outSize); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /bsnes/snes/ppu/debugger/debugger.hpp: -------------------------------------------------------------------------------- 1 | class PPUDebugger : public PPU, public ChipDebugger { 2 | public: 3 | uint8 vram_read(unsigned addr); 4 | void vram_write(unsigned addr, uint8 data); 5 | 6 | uint8 oam_read(unsigned addr); 7 | void oam_write(unsigned addr, uint8 data); 8 | 9 | uint8 cgram_read(unsigned addr); 10 | void cgram_write(unsigned addr, uint8 data); 11 | 12 | unsigned vram_start_addr() const; 13 | uint8 bg_mode() const; 14 | unsigned bg_screen_addr(unsigned index) const; 15 | uint8 bg_screen_size(unsigned index) const; 16 | unsigned bg_tile_addr(unsigned index) const; 17 | uint8 bg_tile_size(unsigned index) const; 18 | unsigned oam_tile_addr(unsigned index) const; 19 | uint8 oam_base_size() const; 20 | unsigned oam_first_sprite() const; 21 | bool mode7_extbg() const; 22 | bool property(unsigned id, string &name, string &value); 23 | }; 24 | -------------------------------------------------------------------------------- /bsnes/snes/alt/ppu/debugger/debugger.hpp: -------------------------------------------------------------------------------- 1 | class PPUDebugger : public PPU, public ChipDebugger { 2 | public: 3 | uint8 vram_mmio_read(uint16 addr); 4 | void vram_mmio_write(uint16 addr, uint8 data); 5 | 6 | uint8 oam_mmio_read(uint16 addr); 7 | void oam_mmio_write(uint16 addr, uint8 data); 8 | 9 | uint8 cgram_mmio_read(uint16 addr); 10 | void cgram_mmio_write(uint16 addr, uint8 data); 11 | 12 | uint16 vram_start_addr() const; 13 | uint8 bg_mode() const; 14 | uint16 bg_screen_addr(unsigned index) const; 15 | uint8 bg_screen_size(unsigned index) const; 16 | uint16 bg_tile_addr(unsigned index) const; 17 | uint8 bg_tile_size(unsigned index) const; 18 | uint16 oam_tile_addr(unsigned index) const; 19 | uint8 oam_base_size() const; 20 | unsigned oam_first_sprite() const; 21 | bool mode7_extbg() const; 22 | bool property(unsigned id, string &name, string &value); 23 | }; 24 | -------------------------------------------------------------------------------- /bsnes/snes/audio/audio.hpp: -------------------------------------------------------------------------------- 1 | class Stream { 2 | public: 3 | Stream(); 4 | void audio_init(); 5 | alwaysinline bool has_sample(); 6 | alwaysinline uint32 get_sample(); 7 | 8 | protected: 9 | void audio_frequency(double frequency); 10 | void sample(int16 left, int16 right); 11 | 12 | private: 13 | struct { 14 | uint32 buffer[32768]; 15 | unsigned rdoffset; 16 | unsigned wroffset; 17 | unsigned length; 18 | 19 | double r_step, r_frac; 20 | int r_sum_l, r_sum_r; 21 | } stream_; 22 | }; 23 | 24 | class Audio { 25 | public: 26 | void init(); 27 | void add_stream(Stream* stream); 28 | void sample(int16 left, int16 right); 29 | void flush(); 30 | 31 | private: 32 | uint32 dsp_buffer[32768]; 33 | unsigned dsp_rdoffset; 34 | unsigned dsp_wroffset; 35 | unsigned dsp_length; 36 | 37 | linear_vector streams; 38 | }; 39 | 40 | extern Audio audio; 41 | -------------------------------------------------------------------------------- /common/nall/moduloarray.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_MODULO_HPP 2 | #define NALL_MODULO_HPP 3 | 4 | #include 5 | 6 | namespace nall { 7 | template class modulo_array { 8 | public: 9 | inline T operator[](int index) const { 10 | return buffer[size + index]; 11 | } 12 | 13 | inline T read(int index) const { 14 | return buffer[size + index]; 15 | } 16 | 17 | inline void write(unsigned index, const T value) { 18 | buffer[index] = 19 | buffer[index + size] = 20 | buffer[index + size + size] = value; 21 | } 22 | 23 | void serialize(serializer &s) { 24 | s.array(buffer, size * 3); 25 | } 26 | 27 | modulo_array() { 28 | buffer = new T[size * 3](); 29 | } 30 | 31 | ~modulo_array() { 32 | delete[] buffer; 33 | } 34 | 35 | private: 36 | T *buffer; 37 | }; 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /bsnes/ruby/video.hpp: -------------------------------------------------------------------------------- 1 | class Video { 2 | public: 3 | static const char *Handle; 4 | static const char *Synchronize; 5 | static const char *Filter; 6 | static const char *Shader; 7 | static const char *FragmentShader; 8 | static const char *VertexShader; 9 | 10 | enum Filter { 11 | FilterPoint, 12 | FilterLinear, 13 | }; 14 | 15 | virtual bool cap(const nall::string& name) { return false; } 16 | virtual nall::any get(const nall::string& name) { return false; } 17 | virtual bool set(const nall::string& name, const nall::any& value) { return false; } 18 | 19 | virtual bool lock(uint32_t *&data, unsigned &pitch, unsigned width, unsigned height) { return false; } 20 | virtual void unlock() {} 21 | 22 | virtual void clear() {} 23 | virtual void refresh() {} 24 | virtual bool init() { return true; } 25 | virtual void term() {} 26 | 27 | Video() {} 28 | virtual ~Video() {} 29 | }; 30 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/ppu/base-renderer.hpp: -------------------------------------------------------------------------------- 1 | struct BaseRenderer { 2 | enum BitDepth { BPP8, BPP4, BPP2, MODE7, MODE7_EXTBG, NONE }; 3 | 4 | QRgb customBackgroundColor; 5 | QRgb palette[256]; 6 | QImage image; 7 | 8 | BitDepth bitDepth; 9 | 10 | bool overrideBackgroundColor; 11 | 12 | public: 13 | BaseRenderer(); 14 | 15 | bool isMode7() const; 16 | 17 | unsigned bytesInbetweenTiles() const; 18 | unsigned colorsPerTile() const; 19 | 20 | static BitDepth bitDepthForLayer(unsigned screenMode, unsigned layer); 21 | 22 | protected: 23 | void buildPalette(); 24 | 25 | void initImage(unsigned width, unsigned height); 26 | void invalidateImage(); 27 | 28 | void draw8pxTile(QRgb* imgBits, const unsigned wordsPerScanline, const uint8_t* tile, unsigned palOffset, bool hFlip, bool vFlip); 29 | 30 | void drawMode7Tile(QRgb* imgBits, const unsigned wordsPerScanline, const uint8_t* tile); 31 | }; 32 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/tracer.moc.hpp: -------------------------------------------------------------------------------- 1 | class Tracer : public QObject { 2 | Q_OBJECT 3 | 4 | public: 5 | void stepCpu(); 6 | void stepSmp(); 7 | void stepSa1(); 8 | void stepSfx(); 9 | void stepSgb(); 10 | 11 | Tracer(); 12 | ~Tracer(); 13 | 14 | public slots: 15 | void setCpuTraceState(int); 16 | void setSmpTraceState(int); 17 | void setSa1TraceState(int); 18 | void setSfxTraceState(int); 19 | void setSgbTraceState(int); 20 | void setTraceMaskState(bool); 21 | 22 | void resetTraceState(); 23 | 24 | private: 25 | void setTraceState(bool); 26 | 27 | file tracefile; 28 | bool traceCpu; 29 | bool traceSmp; 30 | bool traceSa1; 31 | bool traceSfx; 32 | bool traceSgb; 33 | bool traceMask; 34 | 35 | uint8_t *traceMaskCPU; 36 | uint8_t *traceMaskSMP; 37 | uint8_t *traceMaskSA1; 38 | uint8_t *traceMaskSFX; 39 | uint8_t *traceMaskSGB; 40 | }; 41 | 42 | extern Tracer *tracer; 43 | -------------------------------------------------------------------------------- /bsnes/data/default.sgb.sym: -------------------------------------------------------------------------------- 1 | ; default registers used for Super Game Boy 2 | 3 | [labels] 4 | 00:FF00 GB.JOYP 5 | 00:FF01 GB.SB 6 | 00:FF02 GB.SC 7 | 00:FF04 GB.DIV 8 | 00:FF05 GB.TIMA 9 | 00:FF06 GB.TMA 10 | 00:FF07 GB.TAC 11 | 00:FF0F GB.IF 12 | 00:FF10 GB.NR10 13 | 00:FF11 GB.NR11 14 | 00:FF12 GB.NR12 15 | 00:FF13 GB.NR13 16 | 00:FF14 GB.NR14 17 | 00:FF16 GB.NR21 18 | 00:FF17 GB.NR22 19 | 00:FF18 GB.NR23 20 | 00:FF19 GB.NR24 21 | 00:FF1A GB.NR30 22 | 00:FF1B GB.NR31 23 | 00:FF1C GB.NR32 24 | 00:FF1D GB.NR33 25 | 00:FF1E GB.NR34 26 | 00:FF20 GB.NR41 27 | 00:FF21 GB.NR42 28 | 00:FF22 GB.NR43 29 | 00:FF23 GB.NR44 30 | 00:FF24 GB.NR50 31 | 00:FF25 GB.NR51 32 | 00:FF26 GB.NR52 33 | 00:FF40 GB.LCDC 34 | 00:FF41 GB.STAT 35 | 00:FF42 GB.SCY 36 | 00:FF43 GB.SCX 37 | 00:FF44 GB.LY 38 | 00:FF45 GB.LYC 39 | 00:FF46 GB.DMA 40 | 00:FF47 GB.BGP 41 | 00:FF48 GB.OBP0 42 | 00:FF49 GB.OBP1 43 | 00:FF4A GB.WY 44 | 00:FF4B GB.WX 45 | 00:FFFF GB.IE 46 | -------------------------------------------------------------------------------- /bsnes/snes/cpu/memory/memory.cpp: -------------------------------------------------------------------------------- 1 | #ifdef CPU_CPP 2 | 3 | void CPU::op_io() { 4 | status.clock_count = 6; 5 | dma_edge(); 6 | add_clocks(6); 7 | alu_edge(); 8 | } 9 | 10 | uint8 CPU::op_read(uint32 addr) { 11 | status.clock_count = speed(addr); 12 | dma_edge(); 13 | add_clocks(status.clock_count - 4); 14 | regs.mdr = bus.read(addr); 15 | add_clocks(4); 16 | alu_edge(); 17 | return regs.mdr; 18 | } 19 | 20 | void CPU::op_write(uint32 addr, uint8 data) { 21 | alu_edge(); 22 | status.clock_count = speed(addr); 23 | dma_edge(); 24 | add_clocks(status.clock_count); 25 | bus.write(addr, regs.mdr = data); 26 | } 27 | 28 | unsigned CPU::speed(unsigned addr) const { 29 | if(addr & 0x408000) { 30 | if(addr & 0x800000) return status.rom_speed; 31 | return 8; 32 | } 33 | if((addr + 0x6000) & 0x4000) return 8; 34 | if((addr - 0x4000) & 0x7e00) return 6; 35 | return 12; 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /bsnes/ui-qt/tools/effecttoggle.moc.hpp: -------------------------------------------------------------------------------- 1 | class EffectToggleWindow : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | QGridLayout *layout; 6 | QLabel *ppuLabel; 7 | QCheckBox *bg1pri0; 8 | QCheckBox *bg1pri1; 9 | QCheckBox *bg2pri0; 10 | QCheckBox *bg2pri1; 11 | QCheckBox *bg3pri0; 12 | QCheckBox *bg3pri1; 13 | QCheckBox *bg4pri0; 14 | QCheckBox *bg4pri1; 15 | QCheckBox *oampri0; 16 | QCheckBox *oampri1; 17 | QCheckBox *oampri2; 18 | QCheckBox *oampri3; 19 | QLabel *dspLabel; 20 | QCheckBox *channel0; 21 | QCheckBox *channel1; 22 | QCheckBox *channel2; 23 | QCheckBox *channel3; 24 | QCheckBox *channel4; 25 | QCheckBox *channel5; 26 | QCheckBox *channel6; 27 | QCheckBox *channel7; 28 | 29 | EffectToggleWindow(); 30 | 31 | public slots: 32 | void synchronize(); 33 | void synchronize_ppu(); 34 | void synchronize_dsp(); 35 | }; 36 | 37 | extern EffectToggleWindow *effectToggleWindow; 38 | -------------------------------------------------------------------------------- /snesfilter/ntsc/snes_ntsc/snes_ntsc_config.h: -------------------------------------------------------------------------------- 1 | /* Configure library by modifying this file */ 2 | 3 | #ifndef SNES_NTSC_CONFIG_H 4 | #define SNES_NTSC_CONFIG_H 5 | 6 | /* Format of source pixels */ 7 | /* #define SNES_NTSC_IN_FORMAT SNES_NTSC_RGB16 */ 8 | #define SNES_NTSC_IN_FORMAT SNES_NTSC_BGR15 9 | 10 | /* The following affect the built-in blitter only; a custom blitter can 11 | handle things however it wants. */ 12 | 13 | /* Bits per pixel of output. Can be 15, 16, 32, or 24 (same as 32). */ 14 | #define SNES_NTSC_OUT_DEPTH 32 15 | 16 | /* Type of input pixel values */ 17 | #define SNES_NTSC_IN_T unsigned short 18 | 19 | /* Each raw pixel input value is passed through this. You might want to mask 20 | the pixel index if you use the high bits as flags, etc. */ 21 | #define SNES_NTSC_ADJ_IN( in ) in 22 | 23 | /* For each pixel, this is the basic operation: 24 | output_color = SNES_NTSC_ADJ_IN( SNES_NTSC_IN_T ) */ 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/symbols/adapters/fma_symbol_file.hpp: -------------------------------------------------------------------------------- 1 | #include "symbol_file_interface.hpp" 2 | 3 | class FmaSymbolFile : public SymbolFileInterface { 4 | public: 5 | FmaSymbolFile() {} 6 | virtual ~FmaSymbolFile() {} 7 | 8 | const char *getName() const; 9 | const char *getDescription() const; 10 | 11 | int32_t scoreReadString(const lstring &rows) const; 12 | bool read(const lstring &rows, SymbolMap *map) const; 13 | 14 | bool write(nall::file &file, SymbolMap *map) const; 15 | 16 | uint32_t getFeatures() const; 17 | 18 | protected: 19 | string filteredRow(const string &input) const; 20 | void readSymbol(SymbolMap *map, const lstring &args) const; 21 | void readComment(SymbolMap *map, const lstring &args) const; 22 | 23 | string writeAddress(uint32_t address) const; 24 | 25 | uint32_t parseAddress(const string &arg) const; 26 | void parseArgs(const string &row, lstring &args) const; 27 | }; 28 | -------------------------------------------------------------------------------- /bsnes/snes/cartridge/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef CARTRIDGE_CPP 2 | 3 | void Cartridge::serialize(serializer &s) { 4 | if(memory::cartram.size() != 0) { 5 | s.array(memory::cartram.data(), memory::cartram.size()); 6 | } 7 | 8 | if(memory::cartrtc.size() != 0) { 9 | s.array(memory::cartrtc.data(), memory::cartrtc.size()); 10 | } 11 | 12 | if(memory::bsxpram.size() != 0) { 13 | s.array(memory::bsxpram.data(), memory::bsxpram.size()); 14 | } 15 | 16 | if(memory::stAram.size() != 0) { 17 | s.array(memory::stAram.data(), memory::stAram.size()); 18 | } 19 | 20 | if(memory::stBram.size() != 0) { 21 | s.array(memory::stBram.data(), memory::stBram.size()); 22 | } 23 | 24 | if(memory::gbram.size() != 0) { 25 | s.array(memory::gbram.data(), memory::gbram.size()); 26 | } 27 | 28 | if(memory::gbrtc.size() != 0) { 29 | s.array(memory::gbrtc.data(), memory::gbrtc.size()); 30 | } 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /bsnes/snes/config/config.hpp: -------------------------------------------------------------------------------- 1 | struct Configuration { 2 | Input::Device controller_port1; 3 | Input::Device controller_port2; 4 | System::ExpansionPortDevice expansion_port; 5 | unsigned vram_size; 6 | System::Region region; 7 | bool random; 8 | 9 | struct CPU { 10 | unsigned version; 11 | unsigned ntsc_frequency; 12 | unsigned pal_frequency; 13 | unsigned wram_init_value; 14 | } cpu; 15 | 16 | struct SMP { 17 | unsigned ntsc_frequency; 18 | unsigned pal_frequency; 19 | } smp; 20 | 21 | struct PPU1 { 22 | unsigned version; 23 | } ppu1; 24 | 25 | struct PPU2 { 26 | unsigned version; 27 | } ppu2; 28 | 29 | struct Path { 30 | string firmware; 31 | string bsxdat; 32 | } path; 33 | 34 | struct Satellaview { 35 | bool local_time; 36 | time_t custom_time; 37 | unsigned default_size; 38 | } sat; 39 | 40 | Configuration(); 41 | }; 42 | 43 | Configuration &config(); 44 | -------------------------------------------------------------------------------- /snesreader/libjma/crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2004-2007 NSRT Team ( http://nsrt.edgeemu.com ) 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | version 2 as published by the Free Software Foundation. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 | */ 17 | 18 | #ifndef CRC32_H 19 | #define CRC32_H 20 | 21 | namespace CRC32lib 22 | { 23 | unsigned int CRC32(const unsigned char *, size_t, register unsigned int crc32 = 0xFFFFFFFF); 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /bsnes/data/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleExecutable 6 | bsnes 7 | CFBundleIconFile 8 | AppIcon 9 | CFBundleIdentifier 10 | org.bsnes.bsnes-plus 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | bsnes+ 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | @VERSION 19 | CFBundleVersion 20 | @VERSION 21 | LSMinimumSystemVersion 22 | 10.6 23 | NSPrincipalClass 24 | NSApplication 25 | NSHighResolutionCapable 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /bsnes/libco/libco.c: -------------------------------------------------------------------------------- 1 | /* 2 | libco 3 | license: public domain 4 | */ 5 | 6 | #if defined(__clang__) || defined(__GNUC__) 7 | #if defined(__i386__) 8 | #if defined(LIBCO_NO_INLINE_ASM) 9 | #include "x86.c" 10 | #else 11 | #include "x86_gcc.c" 12 | #endif 13 | #elif defined(__amd64__) 14 | #if defined(LIBCO_NO_INLINE_ASM) 15 | #include "amd64.c" 16 | #else 17 | #include "amd64_gcc.c" 18 | #endif 19 | #elif defined(__arm__) 20 | #include "arm.c" 21 | #elif defined(_ARCH_PPC) 22 | #include "ppc.c" 23 | #elif defined(_WIN32) 24 | #include "fiber.c" 25 | #else 26 | #include "sjlj.c" 27 | #endif 28 | #elif defined(_MSC_VER) 29 | #if defined(_M_IX86) 30 | #include "x86.c" 31 | #elif defined(_M_AMD64) 32 | #include "amd64.c" 33 | #else 34 | #include "fiber.c" 35 | #endif 36 | #else 37 | #error "libco: unsupported processor, compiler or operating system" 38 | #endif 39 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/ppu/tilemap-renderer.hpp: -------------------------------------------------------------------------------- 1 | struct TilemapRenderer : public BaseRenderer { 2 | unsigned screenMode; 3 | unsigned layer; 4 | bool hires; 5 | 6 | unsigned tileAddr; 7 | unsigned screenAddr; 8 | 9 | bool screenSizeX; 10 | bool screenSizeY; 11 | bool tileSize; 12 | 13 | public: 14 | TilemapRenderer(); 15 | 16 | void updateBitDepth(); 17 | void loadScreenMode(); 18 | void loadTilemapSettings(); 19 | 20 | unsigned nLayersInMode() const; 21 | unsigned tileSizePx() const; 22 | 23 | void drawTilemap(); 24 | 25 | unsigned characterAddress(unsigned c) const; 26 | 27 | private: 28 | void drawMap(unsigned mapAddr, unsigned startX, unsigned startY); 29 | void drawMapTile(QRgb* imgBits, const unsigned wordsPerScanline, const uint8_t* map); 30 | void drawMap8pxTile(QRgb* imgBits, const unsigned wordsPerScanline, unsigned c, unsigned palOffset, bool hFlip, bool vFlip); 31 | 32 | void drawMode7Tilemap(); 33 | }; 34 | -------------------------------------------------------------------------------- /bsnes/ui-qt/tools/soundviewer.moc.hpp: -------------------------------------------------------------------------------- 1 | class SoundViewerWidget : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | SoundViewerWidget(unsigned ch); 6 | 7 | void refresh(); 8 | 9 | protected: 10 | void paintEvent(QPaintEvent*); 11 | 12 | private: 13 | void initPixmap(); 14 | 15 | double volume, panL, panR; 16 | unsigned channel; 17 | int note; 18 | 19 | QPixmap pixmap; 20 | QRect keyRect[12]; 21 | }; 22 | 23 | class SoundViewerWindow : public Window { 24 | Q_OBJECT 25 | 26 | public: 27 | QVBoxLayout *layout; 28 | QCheckBox *channelEnable[8]; 29 | QLabel *channelSource[8]; 30 | QCheckBox *channelEcho[8]; 31 | QCheckBox *channelNoise[8]; 32 | QCheckBox *channelPitchMod[8]; 33 | SoundViewerWidget *viewer[8]; 34 | 35 | SoundViewerWindow(); 36 | 37 | public slots: 38 | void synchronize(); 39 | void setVisible(bool); 40 | 41 | private slots: 42 | void synchronizeDSP(); 43 | }; 44 | 45 | extern SoundViewerWindow *soundViewerWindow; 46 | -------------------------------------------------------------------------------- /bsnes/data/bsnes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /common/nall/qt/check-action.moc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_QT_CHECKACTION_HPP 2 | #define NALL_QT_CHECKACTION_HPP 3 | 4 | namespace nall { 5 | 6 | class CheckAction : public QAction { 7 | Q_OBJECT 8 | 9 | public: 10 | bool isChecked() const; 11 | void setChecked(bool); 12 | void toggleChecked(); 13 | CheckAction(const QString&, QObject*); 14 | 15 | protected slots: 16 | 17 | protected: 18 | bool checked; 19 | }; 20 | 21 | inline bool CheckAction::isChecked() const { 22 | return checked; 23 | } 24 | 25 | inline void CheckAction::setChecked(bool checked_) { 26 | checked = checked_; 27 | if(checked) setIcon(QIcon(":/16x16/item-check-on.png")); 28 | else setIcon(QIcon(":/16x16/item-check-off.png")); 29 | } 30 | 31 | inline void CheckAction::toggleChecked() { 32 | setChecked(!isChecked()); 33 | } 34 | 35 | inline CheckAction::CheckAction(const QString &text, QObject *parent) : QAction(text, parent) { 36 | setChecked(false); 37 | } 38 | 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /common/nall/qt/radio-action.moc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_QT_RADIOACTION_HPP 2 | #define NALL_QT_RADIOACTION_HPP 3 | 4 | namespace nall { 5 | 6 | class RadioAction : public QAction { 7 | Q_OBJECT 8 | 9 | public: 10 | bool isChecked() const; 11 | void setChecked(bool); 12 | void toggleChecked(); 13 | RadioAction(const QString&, QObject*); 14 | 15 | protected slots: 16 | 17 | protected: 18 | bool checked; 19 | }; 20 | 21 | inline bool RadioAction::isChecked() const { 22 | return checked; 23 | } 24 | 25 | inline void RadioAction::setChecked(bool checked_) { 26 | checked = checked_; 27 | if(checked) setIcon(QIcon(":/16x16/item-radio-on.png")); 28 | else setIcon(QIcon(":/16x16/item-radio-off.png")); 29 | } 30 | 31 | inline void RadioAction::toggleChecked() { 32 | setChecked(!isChecked()); 33 | } 34 | 35 | inline RadioAction::RadioAction(const QString &text, QObject *parent) : QAction(text, parent) { 36 | setChecked(false); 37 | } 38 | 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /bsnes/ui-qt/link/music.cpp: -------------------------------------------------------------------------------- 1 | Music music; 2 | 3 | const char* Music::default_supported() { 4 | return ""; 5 | } 6 | 7 | void Music::default_unload() { 8 | } 9 | 10 | bool Music::default_loaded() { 11 | return false; 12 | } 13 | 14 | bool Music::default_load_spc(string&, uint8_t*&, uint16_t&, uint8_t(&)[4], uint8_t&) { 15 | return false; 16 | } 17 | 18 | bool Music::default_load_snsf(string&, uint8_t*&, unsigned&) { 19 | return false; 20 | } 21 | 22 | void Music::default_render(uint16_t*, unsigned, unsigned, unsigned) { 23 | } 24 | 25 | Music::Music() { 26 | #define _sym(n) \ 27 | n = sym("snesmusic_"#n); \ 28 | if (!n) n = { &Music::default_##n, this } 29 | 30 | open("snesmusic"); 31 | 32 | _sym(supported); 33 | _sym(unload); 34 | _sym(loaded); 35 | _sym(load_spc); 36 | _sym(load_snsf); 37 | _sym(render); 38 | 39 | #undef _sym 40 | 41 | extensionList = supported(); 42 | if(extensionList.length() > 0) extensionList = string() << " " << extensionList; 43 | } 44 | -------------------------------------------------------------------------------- /snesreader/fex/blargg_config.h: -------------------------------------------------------------------------------- 1 | // Library configuration. Modify this file as necessary. 2 | 3 | // File_Extractor 1.0.0 4 | #ifndef BLARGG_CONFIG_H 5 | #define BLARGG_CONFIG_H 6 | 7 | // Uncomment a #define line below to have effect described. 8 | 9 | // Enable RAR archive support. Doing so adds extra licensing restrictions 10 | // to this library (see unrar/readme.txt for more information). 11 | //#define FEX_ENABLE_RAR 1 12 | 13 | // Accept file paths encoded as UTF-8. Currently only affects Windows, 14 | // as Unix/Linux/Mac OS X already use UTF-8 paths. 15 | //#define BLARGG_UTF8_PATHS 1 16 | 17 | // Enable support for as building DLL on Windows. 18 | //#define BLARGG_BUILD_DLL 1 19 | 20 | // Support only the listed archive types. Remove any you don't need. 21 | #define FEX_TYPE_LIST \ 22 | fex_7z_type,\ 23 | fex_gz_type,\ 24 | fex_zip_type, 25 | 26 | // Use standard config.h if present 27 | #ifdef HAVE_CONFIG_H 28 | #include "config.h" 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /bsnes/snes/alt/dsp/dsp.hpp: -------------------------------------------------------------------------------- 1 | #include "SPC_DSP.h" 2 | 3 | class DSP : public Processor { 4 | public: 5 | enum : bool { Threaded = false }; 6 | enum : bool { SupportsChannelEnable = true }; 7 | 8 | alwaysinline void step(unsigned clocks); 9 | alwaysinline void synchronize_smp(); 10 | 11 | bool mute(); 12 | uint8 read(uint8 addr); 13 | void write(uint8 addr, uint8 data); 14 | void load(uint8 const regs [SPC_DSP::register_count]); 15 | 16 | void enter(); 17 | void power(); 18 | void reset(); 19 | 20 | void channel_enable(unsigned channel, bool enable); 21 | bool is_channel_enabled(unsigned channel); 22 | 23 | void serialize(serializer&); 24 | DSP(); 25 | 26 | private: 27 | void update_channels(); 28 | 29 | SPC_DSP spc_dsp; 30 | int16 samplebuffer[8192]; 31 | bool channel_enabled[8]; 32 | }; 33 | 34 | #if defined(DEBUGGER) 35 | #include "../../dsp/debugger/debugger.hpp" 36 | extern DSPDebugger dsp; 37 | #else 38 | extern DSP dsp; 39 | #endif 40 | -------------------------------------------------------------------------------- /bsnes/snes/config/config.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SYSTEM_CPP 2 | 3 | Configuration &config() { 4 | static Configuration configuration; 5 | return configuration; 6 | } 7 | 8 | Configuration::Configuration() { 9 | controller_port1 = Input::Device::Joypad; 10 | controller_port2 = Input::Device::Joypad; 11 | expansion_port = System::ExpansionPortDevice::BSX; 12 | vram_size = 0; // 64 kb 13 | region = System::Region::Autodetect; 14 | random = true; 15 | 16 | cpu.version = 2; 17 | cpu.ntsc_frequency = 21477272; //315 / 88 * 6000000 18 | cpu.pal_frequency = 21281370; 19 | cpu.wram_init_value = 0x55; 20 | 21 | smp.ntsc_frequency = 24607104; //32040.5 * 768 22 | smp.pal_frequency = 24607104; 23 | 24 | ppu1.version = 1; 25 | ppu2.version = 3; 26 | 27 | path.bsxdat = "./bsxdat/"; 28 | 29 | sat.local_time = true; 30 | sat.custom_time = 798653040; // 1995-04-23 16:04 31 | sat.default_size = 2; // 8 Mbit 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /snesreader/fex/Zip7_Extractor.h: -------------------------------------------------------------------------------- 1 | // 7-zip archive extractor 2 | 3 | // File_Extractor 1.0.0 4 | #ifndef ZIP7_EXTRACTOR_H 5 | #define ZIP7_EXTRACTOR_H 6 | 7 | #include "File_Extractor.h" 8 | 9 | struct Zip7_Extractor_Impl; 10 | 11 | class Zip7_Extractor : public File_Extractor { 12 | public: 13 | Zip7_Extractor(); 14 | virtual ~Zip7_Extractor(); 15 | 16 | protected: 17 | virtual blargg_err_t open_v(); 18 | virtual void close_v(); 19 | 20 | virtual blargg_err_t next_v(); 21 | virtual blargg_err_t rewind_v(); 22 | virtual fex_pos_t tell_arc_v() const; 23 | virtual blargg_err_t seek_arc_v( fex_pos_t ); 24 | 25 | virtual blargg_err_t data_v( void const** out ); 26 | 27 | bool utf16ToUtf8( unsigned char* dest, size_t* destLen, const short* src, size_t srcLen ); 28 | 29 | private: 30 | Zip7_Extractor_Impl* impl; 31 | int index; 32 | blargg_vector name8; 33 | blargg_vector name16; 34 | 35 | blargg_err_t zip7_err( int err ); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /bsnes/thrift/thrift/thrift-config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #ifdef _WIN32 21 | #include 22 | #else 23 | #include 24 | #endif 25 | -------------------------------------------------------------------------------- /bsnes/data/default_sfx.cpu.sym: -------------------------------------------------------------------------------- 1 | ; default registers used for SuperFX/GSU (from CPU side) 2 | 3 | [labels] 4 | 00:3000 GSU.R0 5 | 00:3001 GSU.R0H 6 | 00:3002 GSU.R1 7 | 00:3003 GSU.R1H 8 | 00:3004 GSU.R2 9 | 00:3005 GSU.R2H 10 | 00:3006 GSU.R3 11 | 00:3007 GSU.R3H 12 | 00:3008 GSU.R4 13 | 00:3009 GSU.R4H 14 | 00:300A GSU.R5 15 | 00:300B GSU.R5H 16 | 00:300C GSU.R6 17 | 00:300D GSU.R6H 18 | 00:300E GSU.R7 19 | 00:300F GSU.R7H 20 | 00:3010 GSU.R8 21 | 00:3011 GSU.R8H 22 | 00:3012 GSU.R9 23 | 00:3013 GSU.R9H 24 | 00:3014 GSU.R10 25 | 00:3015 GSU.R10H 26 | 00:3016 GSU.R11 27 | 00:3017 GSU.R11H 28 | 00:3018 GSU.R12 29 | 00:3019 GSU.R12H 30 | 00:301A GSU.R13 31 | 00:301B GSU.R13H 32 | 00:301C GSU.R14 33 | 00:301D GSU.R14H 34 | 00:301E GSU.R15 35 | 00:301F GSU.R15H 36 | 00:3030 GSU.SFR 37 | 00:3031 GSU.SFRH 38 | 00:3033 GSU.BRAMR 39 | 00:3034 GSU.PBR 40 | 00:3036 GSU.ROMBR 41 | 00:3037 GSU.CFGR 42 | 00:3038 GSU.SCBR 43 | 00:3039 GSU.CLSR 44 | 00:303A GSU.SCMR 45 | 00:303B GSU.VCR 46 | 00:303C GSU.RAMBR 47 | 00:303E GSU.CBR 48 | 00:303F GSU.CBRH 49 | -------------------------------------------------------------------------------- /bsnes/snes/chip/msu1/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef MSU1_CPP 2 | 3 | void MSU1::serialize(serializer &s) { 4 | Processor::serialize(s); 5 | 6 | s.integer(mmio.data_offset); 7 | s.integer(mmio.data_seek_offset); 8 | s.integer(mmio.audio_offset); 9 | s.integer(mmio.audio_loop_offset); 10 | 11 | s.integer(mmio.audio_track); 12 | s.integer(mmio.audio_volume); 13 | s.integer(mmio.audio_resume_track); 14 | s.integer(mmio.audio_resume_offset); 15 | 16 | s.integer(mmio.data_busy); 17 | s.integer(mmio.audio_busy); 18 | s.integer(mmio.audio_repeat); 19 | s.integer(mmio.audio_play); 20 | s.integer(mmio.audio_error); 21 | 22 | if(datafile.open()) datafile.close(); 23 | if(datafile.open(string(cartridge.basename(), ".msu"), file::mode::read)) { 24 | datafile.seek(mmio.data_offset); 25 | } 26 | 27 | if(audiofile.open()) audiofile.close(); 28 | if(audiofile.open(string(cartridge.basename(), "-", mmio.audio_track, ".pcm"), file::mode::read)) { 29 | audiofile.seek(mmio.audio_offset); 30 | } 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/tools/properties.moc.hpp: -------------------------------------------------------------------------------- 1 | class PropertiesWidget : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QTreeWidget *list; 7 | 8 | PropertiesWidget(SNES::ChipDebugger &object); 9 | 10 | public slots: 11 | void refresh(); 12 | 13 | private: 14 | SNES::ChipDebugger &object; 15 | }; 16 | 17 | class PropertiesViewer : public Window { 18 | Q_OBJECT 19 | 20 | public: 21 | QVBoxLayout *layout; 22 | QTabWidget *tabWidget; 23 | QHBoxLayout *controlLayout; 24 | QCheckBox *autoUpdateBox; 25 | QPushButton *refreshButton; 26 | 27 | void autoUpdate(); 28 | PropertiesViewer(); 29 | 30 | public slots: 31 | void refresh(); 32 | void show(); 33 | }; 34 | 35 | extern PropertiesWidget *cpuPropertiesTab; 36 | extern PropertiesWidget *smpPropertiesTab; 37 | extern PropertiesWidget *ppuPropertiesTab; 38 | extern PropertiesWidget *dspPropertiesTab; 39 | extern PropertiesWidget *sa1PropertiesTab; 40 | extern PropertiesWidget *sfxPropertiesTab; 41 | extern PropertiesViewer *propertiesViewer; 42 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/processor/sfx_processor.hpp: -------------------------------------------------------------------------------- 1 | class SfxDisasmProcessor : public DisasmProcessor { 2 | public: 3 | SfxDisasmProcessor(SymbolMap*); 4 | 5 | virtual class SymbolMap *getSymbols(); 6 | 7 | virtual uint32_t getBusSize(); 8 | virtual uint32_t findStartLineAddress(uint32_t currentAddress, uint32_t linesBelow); 9 | virtual void findKnownRange(uint32_t currentAddress, uint32_t &startAddress, uint32_t &endAddress, uint32_t ¤tAddressLine, uint32_t &numLines); 10 | virtual bool getLine(DisassemblerLine &result, uint32_t &address); 11 | virtual string getBreakpointBusName(); 12 | virtual uint32_t getCurrentAddress(); 13 | 14 | virtual uint8_t usage(uint32_t address); 15 | virtual uint8_t read(uint32_t address); 16 | virtual void write(uint32_t address, uint8_t data); 17 | 18 | private: 19 | SymbolMap *symbols; 20 | 21 | uint32_t decode(uint32_t type, uint32_t address, uint32_t pc); 22 | void setOpcodeParams(DisassemblerLine &result, SNES::SuperFX::Opcode &opcode, uint32_t address); 23 | 24 | }; 25 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/symbols/adapters/symbol_file_interface.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SYMBOL_FILE_INTERFACE__H 2 | #define SYMBOL_FILE_INTERFACE__H 3 | 4 | class SymbolFileInterface { 5 | public: 6 | SymbolFileInterface() {} 7 | virtual ~SymbolFileInterface() {} 8 | 9 | virtual const char *getName() const = 0; 10 | virtual const char *getDescription() const = 0; 11 | virtual uint32_t getFeatures() const = 0; 12 | 13 | // Readable 14 | virtual int32_t scoreReadString(const nall::lstring &rows) const { 15 | return -1; 16 | }; 17 | virtual bool read(const nall::lstring &rows, SymbolMap *map) const { 18 | return false; 19 | }; 20 | 21 | // Writable 22 | virtual bool write(nall::file &file, SymbolMap *map) const { 23 | return false; 24 | } 25 | 26 | enum SymbolFileFeature { 27 | Readable = 0x0001, 28 | Writable = 0x0002, 29 | 30 | Symbols = 0x0010, 31 | Comments = 0x0020, 32 | DebugInterface = 0x0040, 33 | Files = 0x0080, 34 | LineMap = 0x0100 35 | }; 36 | 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /common/nall/string.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_STRING_HPP 2 | #define NALL_STRING_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace nall { 28 | template<> struct has_length { enum { value = true }; }; 29 | template<> struct has_size { enum { value = true }; }; 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /snesreader/fex/Rar_Extractor.h: -------------------------------------------------------------------------------- 1 | // RAR archive extractor 2 | 3 | // File_Extractor 1.0.0 4 | #ifndef RAR_EXTRACTOR_H 5 | #define RAR_EXTRACTOR_H 6 | 7 | #include "File_Extractor.h" 8 | #include "unrar/unrar.h" 9 | 10 | class Rar_Extractor : public File_Extractor { 11 | public: 12 | Rar_Extractor(); 13 | virtual ~Rar_Extractor(); 14 | 15 | struct read_callback_t 16 | { 17 | const char* err; 18 | int pos; 19 | File_Reader* in; 20 | }; 21 | 22 | protected: 23 | virtual blargg_err_t open_v(); 24 | virtual void close_v(); 25 | 26 | virtual blargg_err_t next_v(); 27 | virtual blargg_err_t rewind_v(); 28 | virtual fex_pos_t tell_arc_v() const; 29 | virtual blargg_err_t seek_arc_v( fex_pos_t ); 30 | 31 | virtual blargg_err_t data_v( void const** ); 32 | virtual blargg_err_t extract_v( void*, int ); 33 | 34 | private: 35 | unrar_t* unrar; 36 | read_callback_t reader; 37 | 38 | blargg_err_t convert_err( unrar_err_t ); 39 | blargg_err_t skip_unextractables(); 40 | blargg_err_t next_raw(); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /snesfilter/2xsai/2xsai.hpp: -------------------------------------------------------------------------------- 1 | class _2xSaIFilter { 2 | public: 3 | void size(unsigned&, unsigned&, unsigned, unsigned); 4 | void render(uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 5 | 6 | _2xSaIFilter(); 7 | ~_2xSaIFilter(); 8 | 9 | private: 10 | uint32_t *temp; 11 | unsigned _width, _height; 12 | } filter_2xsai; 13 | 14 | class Super2xSaIFilter { 15 | public: 16 | void size(unsigned&, unsigned&, unsigned, unsigned); 17 | void render(uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 18 | 19 | Super2xSaIFilter(); 20 | ~Super2xSaIFilter(); 21 | 22 | private: 23 | uint32_t *temp; 24 | unsigned _width, _height; 25 | } filter_super2xsai; 26 | 27 | class SuperEagleFilter { 28 | public: 29 | void size(unsigned&, unsigned&, unsigned, unsigned); 30 | void render(uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 31 | 32 | SuperEagleFilter(); 33 | ~SuperEagleFilter(); 34 | 35 | private: 36 | uint32_t *temp; 37 | unsigned _width, _height; 38 | } filter_supereagle; 39 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/debuggerview.moc.hpp: -------------------------------------------------------------------------------- 1 | class DebuggerView : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | DebuggerView(class RegisterEdit *registers, class DisasmProcessor *processor, bool step=false); 6 | 7 | QHBoxLayout *layout; 8 | QSplitter *consoleLayout; 9 | QVBoxLayout *controlLayout; 10 | QCheckBox *stepProcessor; 11 | QCheckBox *traceProcessor; 12 | QPushButton *symbolsViewer; 13 | class QHexEdit *ramViewer; 14 | class SymbolsView *symbolsViewerDialog; 15 | class DisassemblerView *disassembler; 16 | class DisasmProcessor *processor; 17 | 18 | void refresh(uint32_t address); 19 | uint8_t reader(unsigned addr); 20 | void writer(unsigned addr, uint8_t data); 21 | uint8_t usage(unsigned addr); 22 | 23 | public slots: 24 | void synchronize(); 25 | 26 | signals: 27 | void synchronized(); 28 | void traceStateChanged(int); 29 | 30 | protected: 31 | void resizeEvent(QResizeEvent*); 32 | 33 | private: 34 | class RegisterEdit *registers; 35 | uint32_t addressOffset; 36 | uint32_t cursorPosition; 37 | }; 38 | -------------------------------------------------------------------------------- /common/nall/string/trim.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_STRING_TRIM_HPP 2 | #define NALL_STRING_TRIM_HPP 3 | 4 | namespace nall { 5 | 6 | //limit defaults to zero, which will underflow on first compare; equivalent to no limit 7 | template char* ltrim(char *str, const char *key) { 8 | unsigned limit = Limit; 9 | if(!key || !*key) return str; 10 | while(strbegin(str, key)) { 11 | char *dest = str, *src = str + strlen(key); 12 | while(true) { 13 | *dest = *src++; 14 | if(!*dest) break; 15 | dest++; 16 | } 17 | if(--limit == 0) break; 18 | } 19 | return str; 20 | } 21 | 22 | template char* rtrim(char *str, const char *key) { 23 | unsigned limit = Limit; 24 | if(!key || !*key) return str; 25 | while(strend(str, key)) { 26 | str[strlen(str) - strlen(key)] = 0; 27 | if(--limit == 0) break; 28 | } 29 | return str; 30 | } 31 | 32 | template char* trim(char *str, const char *key) { 33 | return ltrim(rtrim(str, key), key); 34 | } 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/initstate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2008 by sinamas 3 | // 4 | // This program is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License version 2 as 6 | // published by the Free Software Foundation. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License version 2 for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // version 2 along with this program; if not, write to the 15 | // Free Software Foundation, Inc., 16 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 17 | // 18 | 19 | #ifndef INITSTATE_H 20 | #define INITSTATE_H 21 | 22 | namespace gambatte { 23 | 24 | void setInitState(struct SaveState &state, bool cgb, bool gbaCgbMode); 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/processor/smp_processor.hpp: -------------------------------------------------------------------------------- 1 | class SmpDisasmProcessor : public DisasmProcessor { 2 | public: 3 | SmpDisasmProcessor(SymbolMap*); 4 | 5 | virtual class SymbolMap *getSymbols() { 6 | return symbols; 7 | } 8 | 9 | virtual uint32_t getBusSize(); 10 | virtual uint32_t findStartLineAddress(uint32_t currentAddress, uint32_t linesBelow); 11 | virtual void findKnownRange(uint32_t currentAddress, uint32_t &startAddress, uint32_t &endAddress, uint32_t ¤tAddressLine, uint32_t &numLines); 12 | virtual bool getLine(DisassemblerLine &result, uint32_t &address); 13 | virtual string getBreakpointBusName(); 14 | virtual uint32_t getCurrentAddress(); 15 | 16 | virtual uint8_t usage(uint32_t address); 17 | virtual uint8_t read(uint32_t address); 18 | virtual void write(uint32_t address, uint8_t data); 19 | 20 | private: 21 | SymbolMap *symbols; 22 | 23 | uint32_t decode(uint32_t type, uint32_t address, uint32_t pc); 24 | void setOpcodeParams(DisassemblerLine &result, SNES::SMP::Opcode &opcode, uint32_t address); 25 | }; 26 | -------------------------------------------------------------------------------- /bsnes/ui-qt/tools/statemanager.moc.hpp: -------------------------------------------------------------------------------- 1 | class StateManagerWindow : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | enum { StateCount = 32 }; 6 | 7 | QVBoxLayout *layout; 8 | QTreeWidget *list; 9 | QHBoxLayout *infoLayout; 10 | QLabel *descriptionLabel; 11 | QLineEdit *descriptionText; 12 | QHBoxLayout *controlLayout; 13 | QWidget *spacer; 14 | QPushButton *loadButton; 15 | QPushButton *saveButton; 16 | QPushButton *eraseButton; 17 | 18 | void reload(); 19 | void update(); 20 | 21 | StateManagerWindow(); 22 | 23 | public slots: 24 | void synchronize(); 25 | void writeDescription(); 26 | void loadAction(); 27 | void saveAction(); 28 | void eraseAction(); 29 | 30 | private: 31 | string filename() const; 32 | bool isStateValid(unsigned slot); 33 | string getStateDescription(unsigned slot); 34 | void setStateDescription(unsigned slot, const string&); 35 | void loadState(unsigned slot); 36 | void saveState(unsigned slot); 37 | void eraseState(unsigned slot); 38 | }; 39 | 40 | extern StateManagerWindow *stateManagerWindow; 41 | -------------------------------------------------------------------------------- /bsnes/ruby/input/x.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | namespace ruby { 8 | 9 | class pInputX { 10 | public: 11 | Display *display; 12 | #include "xlibkeys.hpp" 13 | 14 | bool cap(const string& name) { 15 | if(name == Input::KeyboardSupport) return true; 16 | return false; 17 | } 18 | 19 | any get(const string& name) { 20 | return false; 21 | } 22 | 23 | bool set(const string& name, const any &value) { 24 | return false; 25 | } 26 | 27 | bool acquire() { return false; } 28 | bool unacquire() { return false; } 29 | bool acquired() { return false; } 30 | 31 | bool poll(int16_t *table) { 32 | memset(table, 0, Scancode::Limit * sizeof(int16_t)); 33 | x_poll(display, table); 34 | return true; 35 | } 36 | 37 | bool init() { 38 | display = XOpenDisplay(0); 39 | x_init(display); 40 | return true; 41 | } 42 | 43 | void term() { 44 | XCloseDisplay(display); 45 | } 46 | }; 47 | 48 | DeclareInput(X) 49 | 50 | }; 51 | -------------------------------------------------------------------------------- /bsnes/ui-qt/settings/paths.moc.hpp: -------------------------------------------------------------------------------- 1 | class PathSettingWidget : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QLabel *label; 7 | QHBoxLayout *controlLayout; 8 | QLineEdit *path; 9 | QPushButton *pathSelect; 10 | QPushButton *pathDefault; 11 | 12 | string &pathValue; 13 | string pathBrowseLabel; 14 | string pathDefaultValue; 15 | void acceptPath(const string&); 16 | 17 | PathSettingWidget(string&, const char*, const char*, const char*, const char*); 18 | 19 | public slots: 20 | void updatePath(); 21 | void selectPath(); 22 | }; 23 | 24 | class PathSettingsWindow : public QWidget { 25 | Q_OBJECT 26 | 27 | public: 28 | QVBoxLayout *layout; 29 | PathSettingWidget *gamePath; 30 | PathSettingWidget *savePath; 31 | PathSettingWidget *statePath; 32 | PathSettingWidget *patchPath; 33 | PathSettingWidget *cheatPath; 34 | PathSettingWidget *dataPath; 35 | PathSettingWidget *firmwarePath; 36 | PathSettingWidget *satdataPath; 37 | 38 | PathSettingsWindow(); 39 | }; 40 | 41 | extern PathSettingsWindow *pathSettingsWindow; 42 | -------------------------------------------------------------------------------- /snesreader/7z_C/7zCrcOpt.c: -------------------------------------------------------------------------------- 1 | /* 7zCrcOpt.c -- CRC32 calculation : optimized version 2 | 2009-11-23 : Igor Pavlov : Public domain */ 3 | 4 | #include "CpuArch.h" 5 | 6 | #ifdef MY_CPU_LE 7 | 8 | #define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 9 | 10 | UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table) 11 | { 12 | const Byte *p = (const Byte *)data; 13 | for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) 14 | v = CRC_UPDATE_BYTE_2(v, *p); 15 | for (; size >= 4; size -= 4, p += 4) 16 | { 17 | v ^= *(const UInt32 *)p; 18 | v = 19 | table[0x300 + (v & 0xFF)] ^ 20 | table[0x200 + ((v >> 8) & 0xFF)] ^ 21 | table[0x100 + ((v >> 16) & 0xFF)] ^ 22 | table[0x000 + ((v >> 24))]; 23 | } 24 | for (; size > 0; size--, p++) 25 | v = CRC_UPDATE_BYTE_2(v, *p); 26 | return v; 27 | } 28 | 29 | UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table) 30 | { 31 | return CrcUpdateT4(v, data, size, table); 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/processor/common_processor.hpp: -------------------------------------------------------------------------------- 1 | class CommonDisasmProcessor : public DisasmProcessor { 2 | public: 3 | enum Source { CPU, SMP, SA1, SFX, SGB }; 4 | 5 | CommonDisasmProcessor(Source); 6 | 7 | void setSource(Source); 8 | 9 | virtual class SymbolMap *getSymbols() { 10 | return NULL; 11 | } 12 | 13 | virtual uint32_t getBusSize(); 14 | virtual uint32_t findStartLineAddress(uint32_t currentAddress, uint32_t linesBelow); 15 | virtual void findKnownRange(uint32_t currentAddress, uint32_t &startAddress, uint32_t &endAddress, uint32_t ¤tAddressLine, uint32_t &numLines); 16 | virtual bool getLine(DisassemblerLine &result, uint32_t &address); 17 | virtual string getBreakpointBusName(); 18 | virtual uint32_t getCurrentAddress(); 19 | 20 | virtual uint8_t usage(uint32_t address); 21 | virtual uint8_t read(uint32_t address); 22 | virtual void write(uint32_t address, uint8_t data); 23 | 24 | private: 25 | Source source; 26 | SNES::Debugger::MemorySource memorySource; 27 | 28 | uint8_t *usagePointer; 29 | unsigned mask; 30 | }; 31 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/include/gbint.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 by sinamas 3 | // 4 | // This program is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License version 2 as 6 | // published by the Free Software Foundation. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License version 2 for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // version 2 along with this program; if not, write to the 15 | // Free Software Foundation, Inc., 16 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 17 | // 18 | 19 | #ifndef GAMBATTE_INT_H 20 | #define GAMBATTE_INT_H 21 | 22 | #include 23 | 24 | namespace gambatte { 25 | typedef uint32_t uint_least32_t; 26 | typedef uint16_t uint_least16_t; 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/loadres.cpp: -------------------------------------------------------------------------------- 1 | #include "loadres.h" 2 | 3 | namespace gambatte { 4 | 5 | static char const * to_cstr(LoadRes const loadres) { 6 | switch (loadres) { 7 | case LOADRES_BAD_FILE_OR_UNKNOWN_MBC: return "Bad file or unknown MBC"; 8 | case LOADRES_IO_ERROR: return "I/O error"; 9 | case LOADRES_UNSUPPORTED_MBC_HUC3: return "Unsupported MBC: HuC3"; 10 | case LOADRES_UNSUPPORTED_MBC_TAMA5: return "Unsupported MBC: Tama5"; 11 | case LOADRES_UNSUPPORTED_MBC_POCKET_CAMERA: return "Unsupported MBC: Pocket Camera"; 12 | case LOADRES_UNSUPPORTED_MBC_MBC7: return "Unsupported MBC: MBC7"; 13 | case LOADRES_UNSUPPORTED_MBC_MBC6: return "Unsupported MBC: MBC6"; 14 | case LOADRES_UNSUPPORTED_MBC_MBC4: return "Unsupported MBC: MBC4"; 15 | case LOADRES_UNSUPPORTED_MBC_MMM01: return "Unsupported MBC: MMM01"; 16 | case LOADRES_OK: return "OK"; 17 | } 18 | 19 | return ""; 20 | } 21 | 22 | std::string const to_string(LoadRes loadres) { return to_cstr(loadres); } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /bsnes/snes/scheduler/scheduler.hpp: -------------------------------------------------------------------------------- 1 | struct Scheduler : property { 2 | enum class Mode : unsigned { Run, Synchronize } mode; 3 | enum class ExitReason : unsigned { UnknownEvent, FrameEvent, SynchronizeEvent, DesynchronizeEvent, DebuggerEvent }; 4 | readonly exit_reason; 5 | 6 | cothread_t host_thread; //program thread (used to exit emulation) 7 | cothread_t thread; //active emulation thread (used to enter emulation) 8 | bool desynchronized; 9 | 10 | void enter(); 11 | void exit(ExitReason); 12 | void resume(cothread_t& thread); 13 | 14 | inline bool synchronizing() const { return mode == Mode::Synchronize; } 15 | inline void synchronize() { 16 | if (mode == Mode::Synchronize) { 17 | if (desynchronized) { 18 | desynchronized = false; 19 | exit(ExitReason::DesynchronizeEvent); 20 | } else { 21 | exit(ExitReason::SynchronizeEvent); 22 | } 23 | } 24 | } 25 | inline void desynchronize() { desynchronized = true; } 26 | 27 | void init(); 28 | Scheduler(); 29 | }; 30 | 31 | extern Scheduler scheduler; 32 | -------------------------------------------------------------------------------- /bsnes/ui-qt/platform/platform_x.cpp: -------------------------------------------------------------------------------- 1 | #define None XNone 2 | #define Window XWindow 3 | #include 4 | #undef None 5 | #undef Window 6 | 7 | struct LibXtst : public library { 8 | function XTestFakeKeyEvent; 9 | 10 | LibXtst() { 11 | if(open("Xtst")) { 12 | XTestFakeKeyEvent = sym("XTestFakeKeyEvent"); 13 | } 14 | } 15 | } libXtst; 16 | 17 | void supressScreenSaver() { 18 | if(!libXtst.XTestFakeKeyEvent) return; 19 | 20 | //XSetScreenSaver(timeout = 0) does not work 21 | //XResetScreenSaver() does not work 22 | //XScreenSaverSuspend() does not work 23 | //DPMSDisable() does not work 24 | //XSendEvent(KeyPressMask) does not work 25 | //use XTest extension to send fake keypress every ~20 seconds. 26 | //keycode of 255 does not map to any actual key, 27 | //but it will block screensaver and power management. 28 | Display *display = XOpenDisplay(0); 29 | libXtst.XTestFakeKeyEvent(display, 255, True, 0); 30 | libXtst.XTestFakeKeyEvent(display, 255, False, 0); 31 | XCloseDisplay(display); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /bsnes/snes/smp/debugger/debugger.hpp: -------------------------------------------------------------------------------- 1 | class SMPDebugger : public SMP, public ChipDebugger { 2 | public: 3 | bool property(unsigned id, string &name, string &value); 4 | 5 | enum Register { 6 | RegisterPC, 7 | RegisterA, 8 | RegisterX, 9 | RegisterY, 10 | RegisterS, 11 | RegisterYA, 12 | RegisterP, 13 | }; 14 | unsigned getRegister(unsigned id); 15 | void setRegister(unsigned id, unsigned value); 16 | 17 | enum { 18 | FlagN, 19 | FlagV, 20 | FlagP, 21 | FlagB, 22 | FlagH, 23 | FlagI, 24 | FlagZ, 25 | FlagC, 26 | }; 27 | bool getFlag(unsigned id); 28 | void setFlag(unsigned id, bool value); 29 | 30 | function step_event; 31 | 32 | enum Usage { 33 | UsageRead = 0x80, 34 | UsageWrite = 0x40, 35 | UsageExec = 0x20, 36 | UsageOpcode = 0x10, 37 | }; 38 | uint8 *usage; 39 | uint16 opcode_pc; 40 | 41 | void op_step(); 42 | uint8_t op_readpc(); 43 | uint8 op_read(uint16 addr); 44 | void op_write(uint16 addr, uint8 data); 45 | 46 | SMPDebugger(); 47 | ~SMPDebugger(); 48 | }; 49 | -------------------------------------------------------------------------------- /bsnes/snes/chip/cx4/bus.cpp: -------------------------------------------------------------------------------- 1 | #ifdef CX4_CPP 2 | 3 | Cx4Bus cx4bus; 4 | 5 | namespace memory { 6 | UnmappedCx4 cx4_unmapped; 7 | Cx4ROM cx4rom; 8 | Cx4RAM cx4ram; 9 | } 10 | 11 | void Cx4Bus::init() { 12 | map(MapMode::Direct, 0x00, 0xff, 0x0000, 0xffff, memory::cx4_unmapped); 13 | 14 | map(MapMode::Linear, 0x00, 0x3f, 0x8000, 0xffff, memory::cartrom); 15 | map(MapMode::Linear, 0x80, 0xbf, 0x8000, 0xffff, memory::cartrom); 16 | map(MapMode::Linear, 0x70, 0x77, 0x0000, 0x7fff, memory::cartram); 17 | } 18 | 19 | unsigned UnmappedCx4::size() const { return 16 * 1024 * 1024; } 20 | uint8 UnmappedCx4::read(unsigned) { return 0; } 21 | void UnmappedCx4::write(unsigned, uint8) {} 22 | 23 | unsigned Cx4ROM::size() const { return memory::cartrom.size(); } 24 | uint8 Cx4ROM::read(unsigned addr) { return cx4.rom_read(addr); } 25 | void Cx4ROM::write(unsigned, uint8) {} 26 | 27 | unsigned Cx4RAM::size() const { return memory::cartram.size(); } 28 | uint8 Cx4RAM::read(unsigned addr) { return cx4.ram_read(addr); } 29 | void Cx4RAM::write(unsigned addr, uint8 data) { return cx4.ram_write(addr, data); } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /common/nall/static.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_STATIC_HPP 2 | #define NALL_STATIC_HPP 3 | 4 | namespace nall { 5 | template struct static_if { typedef T type; }; 6 | template struct static_if { typedef F type; }; 7 | template struct mp_static_if { typedef typename static_if::type type; }; 8 | 9 | template struct static_and { enum { value = false }; }; 10 | template<> struct static_and { enum { value = true }; }; 11 | template struct mp_static_and { enum { value = static_and::value }; }; 12 | 13 | template struct static_or { enum { value = false }; }; 14 | template<> struct static_or { enum { value = true }; }; 15 | template<> struct static_or { enum { value = true }; }; 16 | template<> struct static_or { enum { value = true }; }; 17 | template struct mp_static_or { enum { value = static_or::value }; }; 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /bsnes/snes/chip/msu1/msu1.hpp: -------------------------------------------------------------------------------- 1 | class MSU1 : public Coprocessor, public MMIO, public Stream { 2 | public: 3 | static void Enter(); 4 | void enter(); 5 | void init(); 6 | void enable(); 7 | void power(); 8 | void reset(); 9 | void unload(); 10 | 11 | uint8 mmio_read(unsigned addr); 12 | void mmio_write(unsigned addr, uint8 data); 13 | 14 | void serialize(serializer&); 15 | 16 | private: 17 | file datafile; 18 | file audiofile; 19 | 20 | enum Flag { 21 | DataBusy = 0x80, 22 | AudioBusy = 0x40, 23 | AudioRepeating = 0x20, 24 | AudioPlaying = 0x10, 25 | AudioError = 0x08, 26 | Revision = 0x02, 27 | }; 28 | 29 | struct MMIO { 30 | uint32 data_offset; 31 | uint32 data_seek_offset; 32 | uint32 audio_offset; 33 | uint32 audio_loop_offset; 34 | 35 | uint16 audio_track; 36 | uint8 audio_volume; 37 | uint32 audio_resume_track; 38 | uint32 audio_resume_offset; 39 | 40 | bool data_busy; 41 | bool audio_busy; 42 | bool audio_repeat; 43 | bool audio_play; 44 | bool audio_error; 45 | } mmio; 46 | }; 47 | 48 | extern MSU1 msu1; 49 | -------------------------------------------------------------------------------- /bsnes/snes/ppu/screen/screen.hpp: -------------------------------------------------------------------------------- 1 | class Screen { 2 | uint16 *output; 3 | 4 | struct Regs { 5 | bool addsub_mode; 6 | bool direct_color; 7 | 8 | bool color_mode; 9 | bool color_halve; 10 | bool bg1_color_enable; 11 | bool bg2_color_enable; 12 | bool bg3_color_enable; 13 | bool bg4_color_enable; 14 | bool oam_color_enable; 15 | bool back_color_enable; 16 | 17 | uint16 color; 18 | } regs; 19 | 20 | struct Math { 21 | struct Layer { 22 | uint16 color; 23 | bool color_enable; 24 | } main, sub; 25 | bool transparent; 26 | bool addsub_mode; 27 | bool color_halve; 28 | } math; 29 | 30 | void scanline(); 31 | void run(); 32 | void reset(); 33 | 34 | uint16 light_table[16][32768]; 35 | uint16 get_pixel_sub(bool hires); 36 | uint16 get_pixel_main(); 37 | uint16 addsub(unsigned x, unsigned y); 38 | uint16 get_color(unsigned palette); 39 | uint16 get_direct_color(unsigned palette, unsigned tile); 40 | 41 | void serialize(serializer&); 42 | Screen(PPU &self); 43 | 44 | PPU &self; 45 | friend class PPU; 46 | friend class PPUDebugger; 47 | }; 48 | -------------------------------------------------------------------------------- /common/nall/string/strpos.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_STRING_STRPOS_HPP 2 | #define NALL_STRING_STRPOS_HPP 3 | 4 | //usage example: 5 | //if(auto pos = strpos(str, key)) print(pos(), "\n"); 6 | //prints position of key within str, only if it is found 7 | 8 | namespace nall { 9 | 10 | optional strpos(const char *str, const char *key) { 11 | unsigned ssl = strlen(str), ksl = strlen(key); 12 | if(ksl > ssl) return { false, 0 }; 13 | 14 | for(unsigned i = 0; i <= ssl - ksl; i++) { 15 | if(!memcmp(str + i, key, ksl)) return { true, i }; 16 | } 17 | 18 | return { false, 0 }; 19 | } 20 | 21 | optional qstrpos(const char *str, const char *key) { 22 | unsigned ssl = strlen(str), ksl = strlen(key); 23 | if(ksl > ssl) return { false, 0 }; 24 | 25 | for(unsigned i = 0; i <= ssl - ksl;) { 26 | uint8_t x = str[i]; 27 | if(x == '\"' || x == '\'') { 28 | uint8_t z = i++; 29 | while(str[i] != x && i < ssl) i++; 30 | if(i >= ssl) i = z; 31 | } 32 | if(!memcmp(str + i, key, ksl)) return { true, i }; 33 | i++; 34 | } 35 | 36 | return { false, 0 }; 37 | } 38 | 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /bsnes/libco/fiber.c: -------------------------------------------------------------------------------- 1 | /* 2 | libco.win (2008-01-28) 3 | authors: Nach, byuu 4 | license: public domain 5 | */ 6 | 7 | #define LIBCO_C 8 | #include "libco.h" 9 | 10 | #define WINVER 0x0400 11 | #define _WIN32_WINNT 0x0400 12 | #include 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | static thread_local cothread_t co_active_ = 0; 19 | 20 | static void __stdcall co_thunk(void *coentry) { 21 | ((void (*)(void))coentry)(); 22 | } 23 | 24 | cothread_t co_active() { 25 | if(!co_active_) { 26 | ConvertThreadToFiber(0); 27 | co_active_ = GetCurrentFiber(); 28 | } 29 | return co_active_; 30 | } 31 | 32 | cothread_t co_create(unsigned int heapsize, void (*coentry)(void)) { 33 | if(!co_active_) { 34 | ConvertThreadToFiber(0); 35 | co_active_ = GetCurrentFiber(); 36 | } 37 | return (cothread_t)CreateFiber(heapsize, co_thunk, (void*)coentry); 38 | } 39 | 40 | void co_delete(cothread_t cothread) { 41 | DeleteFiber(cothread); 42 | } 43 | 44 | void co_switch(cothread_t cothread) { 45 | co_active_ = cothread; 46 | SwitchToFiber(cothread); 47 | } 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /snesfilter/pixellate2x/pixellate2x.cpp: -------------------------------------------------------------------------------- 1 | #include "pixellate2x.hpp" 2 | 3 | void Pixellate2xFilter::size(unsigned &outwidth, unsigned &outheight, unsigned width, unsigned height) { 4 | outwidth = (width <= 256) ? width * 2 : width; 5 | outheight = (height <= 240) ? height * 2 : height; 6 | } 7 | 8 | void Pixellate2xFilter::render( 9 | uint32_t *output, unsigned outpitch, 10 | const uint16_t *input, unsigned pitch, unsigned width, unsigned height 11 | ) { 12 | pitch >>= 1; 13 | outpitch >>= 2; 14 | 15 | uint32_t *out0 = output; 16 | uint32_t *out1 = output + outpitch; 17 | 18 | for(unsigned y = 0; y < height; y++) { 19 | for(unsigned x = 0; x < width; x++) { 20 | uint32_t p = colortable[*input++]; 21 | 22 | *out0++ = p; 23 | if(height <= 240) *out1++ = p; 24 | if(width > 256) continue; 25 | 26 | *out0++ = p; 27 | if(height <= 240) *out1++ = p; 28 | } 29 | 30 | input += pitch - width; 31 | if(height <= 240) { 32 | out0 += outpitch + outpitch - 512; 33 | out1 += outpitch + outpitch - 512; 34 | } else { 35 | out0 += outpitch - 512; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /bsnes/snes/cpu/timing/joypad.cpp: -------------------------------------------------------------------------------- 1 | #ifdef CPU_CPP 2 | 3 | void CPU::joypad_edge() { 4 | if(vcounter() >= (ppu.overscan() == false ? 225 : 240)) { 5 | //cache enable state at first iteration 6 | if(status.auto_joypad_counter == 0) 7 | status.auto_joypad_latch = status.auto_joypad_poll; 8 | status.auto_joypad_active = status.auto_joypad_counter <= 15; 9 | 10 | if(status.auto_joypad_active && status.auto_joypad_latch) { 11 | if(status.auto_joypad_counter == 0) { 12 | input.poll(); 13 | 14 | //shift registers are cleared at start of auto joypad polling 15 | status.joy1 = 0; 16 | status.joy2 = 0; 17 | status.joy3 = 0; 18 | status.joy4 = 0; 19 | } 20 | 21 | unsigned port0 = input.port_read(0) & 3; 22 | unsigned port1 = input.port_read(1) & 3; 23 | 24 | status.joy1 = (status.joy1 << 1) | (port0 & 1); 25 | status.joy2 = (status.joy2 << 1) | (port1 & 1); 26 | status.joy3 = (status.joy3 << 1) | (port0 >> 1); 27 | status.joy4 = (status.joy4 << 1) | (port1 >> 1); 28 | } 29 | 30 | status.auto_joypad_counter++; 31 | } 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /bsnes/ui-qt/link/reader.cpp: -------------------------------------------------------------------------------- 1 | Reader reader; 2 | 3 | const char* Reader::direct_supported() { 4 | return ""; 5 | } 6 | 7 | bool Reader::direct_load(string &filename, uint8_t *&data, unsigned &size) { 8 | if(file::exists(filename) == false) return false; 9 | 10 | file fp; 11 | if(fp.open(filename, file::mode::read) == false) return false; 12 | 13 | data = new uint8_t[size = fp.size()]; 14 | fp.read(data, size); 15 | fp.close(); 16 | 17 | return true; 18 | } 19 | 20 | Reader::Reader() { 21 | if(open("snesreader")) { 22 | supported = sym("snesreader_supported"); 23 | load = sym("snesreader_load"); 24 | } 25 | 26 | if(!supported || !load) { 27 | supported = { &Reader::direct_supported, this }; 28 | load = { &Reader::direct_load, this }; 29 | } 30 | 31 | compressionList = supported(); 32 | if(compressionList.length() > 0) compressionList = string() << " " << compressionList; 33 | 34 | if(opened()) { 35 | extensionList = string() 36 | << " *.smc *.swc *.fig" 37 | << " *.ufo *.gd3 *.gd7 *.dx2 *.mgd *.mgh" 38 | << " *.048 *.058 *.068 *.078 *.bin" 39 | << " *.usa *.eur *.jap *.aus *.bsx"; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /snesreader/libjma/ariconst.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) 3 | Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License version 2.1 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #ifndef __ARICONST_H 20 | #define __ARICONST_H 21 | 22 | #include "aribitcd.h" 23 | 24 | 25 | typedef NCompression::NArithmetic::CRangeDecoder CMyRangeDecoder; 26 | template class CMyBitDecoder: 27 | public NCompression::NArithmetic::CBitDecoder {}; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /bsnes/snes/chip/st0018/st0018.hpp: -------------------------------------------------------------------------------- 1 | class ST0018 : public MMIO { 2 | public: 3 | void init(); 4 | void enable(); 5 | void power(); 6 | void reset(); 7 | 8 | uint8 mmio_read(unsigned addr); 9 | void mmio_write(unsigned addr, uint8 data); 10 | 11 | enum mode_t { Waiting, BoardUpload }; 12 | struct regs_t { 13 | mode_t mode; 14 | 15 | uint8 r3800; 16 | uint8 r3800_01; 17 | uint8 r3804; 18 | 19 | unsigned w3804; 20 | unsigned counter; 21 | } regs; 22 | 23 | enum PieceID { 24 | Pawn = 0x00, //foot soldier 25 | Lance = 0x04, //incense chariot 26 | Knight = 0x08, //cassia horse 27 | Silver = 0x0c, //silver general 28 | Gold = 0x10, //gold general 29 | Rook = 0x14, //flying chariot 30 | Bishop = 0x18, //angle mover 31 | King = 0x1c, //king 32 | }; 33 | 34 | enum PieceFlag { 35 | PlayerA = 0x20, 36 | PlayerB = 0x40, 37 | }; 38 | 39 | uint8 board[9 * 9 + 16]; 40 | 41 | private: 42 | void op_board_upload(); 43 | void op_board_upload(uint8 data); 44 | void op_b2(); 45 | void op_b3(); 46 | void op_b4(); 47 | void op_b5(); 48 | void op_query_chip(); 49 | }; 50 | 51 | extern ST0018 st0018; 52 | -------------------------------------------------------------------------------- /snesreader/fex/Gzip_Reader.h: -------------------------------------------------------------------------------- 1 | // Transparently decompresses gzip files, as well as uncompressed 2 | 3 | // File_Extractor 1.0.0 4 | #ifndef GZIP_READER_H 5 | #define GZIP_READER_H 6 | 7 | #include "Data_Reader.h" 8 | #include "Zlib_Inflater.h" 9 | 10 | class Gzip_Reader : public Data_Reader { 11 | public: 12 | // Keeps pointer to reader until close(). If 13 | blargg_err_t open( File_Reader* ); 14 | 15 | // True if file is open 16 | bool opened() const { return in != NULL; } 17 | 18 | // Frees memory 19 | void close(); 20 | 21 | // True if file is compressed 22 | bool deflated() const { return inflater.deflated(); } 23 | 24 | // CRC-32 of data, of 0 if unavailable 25 | unsigned int crc32() const { return crc32_; } 26 | 27 | // Number of bytes read since opening 28 | int tell() const { return size_ - remain(); } 29 | 30 | public: 31 | Gzip_Reader(); 32 | virtual ~Gzip_Reader(); 33 | 34 | protected: 35 | virtual blargg_err_t read_v( void*, int ); 36 | 37 | private: 38 | File_Reader* in; 39 | unsigned crc32_; 40 | int size_; 41 | Zlib_Inflater inflater; 42 | 43 | blargg_err_t calc_size(); 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /common/nall/concept.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_CONCEPT_HPP 2 | #define NALL_CONCEPT_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace nall { 8 | //unsigned count() const; 9 | template struct has_count { enum { value = false }; }; 10 | 11 | //unsigned length() const; 12 | template struct has_length { enum { value = false }; }; 13 | 14 | //unsigned size() const; 15 | template struct has_size { enum { value = false }; }; 16 | 17 | template unsigned container_size(const T& object, typename mp_enable_if>::type = 0) { 18 | return object.count(); 19 | } 20 | 21 | template unsigned container_size(const T& object, typename mp_enable_if>::type = 0) { 22 | return object.length(); 23 | } 24 | 25 | template unsigned container_size(const T& object, typename mp_enable_if>::type = 0) { 26 | return object.size(); 27 | } 28 | 29 | template unsigned container_size(const T& object, typename mp_enable_if>::type = 0) { 30 | return sizeof(T) / sizeof(typename std::remove_extent::type); 31 | } 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /snesreader/libjma/7z.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com ) 3 | Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License version 2.1 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #ifndef __7Z_H 20 | #define __7Z_H 21 | 22 | #include "iiostrm.h" 23 | 24 | bool decompress_lzma_7z(ISequentialInStream& in, unsigned in_size, ISequentialOutStream& out, unsigned out_size) throw (); 25 | bool decompress_lzma_7z(const unsigned char* in_data, unsigned in_size, unsigned char* out_data, unsigned out_size) throw (); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /bsnes/snes/chip/sa1/sa1.hpp: -------------------------------------------------------------------------------- 1 | #include "bus/bus.hpp" 2 | 3 | class SA1 : public Coprocessor, public CPUcore, public MMIO { 4 | public: 5 | #include "dma/dma.hpp" 6 | #include "memory/memory.hpp" 7 | #include "mmio/mmio.hpp" 8 | 9 | struct Status { 10 | uint8 tick_counter; 11 | 12 | bool interrupt_pending; 13 | uint16 interrupt_vector; 14 | 15 | uint16 scanlines; 16 | uint16 vcounter; 17 | uint16 hcounter; 18 | } status; 19 | 20 | static void Enter(); 21 | void enter(); 22 | debugvirtual void interrupt(uint16 vector); 23 | void tick(); 24 | 25 | // used by the SA-1 debugger prior to executing instructions 26 | debugvirtual void op_step() {}; 27 | 28 | alwaysinline void trigger_irq(); 29 | alwaysinline void last_cycle(); 30 | alwaysinline bool interrupt_pending(); 31 | 32 | void init(); 33 | void enable(); 34 | void power(); 35 | void reset(); 36 | 37 | void serialize(serializer&); 38 | SA1(); 39 | }; 40 | 41 | #if defined(DEBUGGER) 42 | #include "debugger/debugger.hpp" 43 | extern SA1Debugger sa1; 44 | extern VBRBus vbrbus; 45 | 46 | extern CPUAnalyst sa1Analyst; 47 | #else 48 | extern SA1 sa1; 49 | #endif 50 | extern SA1Bus sa1bus; 51 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/processor/cpu_processor.hpp: -------------------------------------------------------------------------------- 1 | class CpuDisasmProcessor : public DisasmProcessor { 2 | public: 3 | enum Source { CPU, SA1 }; 4 | 5 | CpuDisasmProcessor(Source, SymbolMap*); 6 | 7 | void setSource(Source); 8 | 9 | virtual class SymbolMap *getSymbols(); 10 | 11 | virtual uint32_t getBusSize(); 12 | virtual uint32_t findStartLineAddress(uint32_t currentAddress, uint32_t linesBelow); 13 | virtual void findKnownRange(uint32_t currentAddress, uint32_t &startAddress, uint32_t &endAddress, uint32_t ¤tAddressLine, uint32_t &numLines); 14 | virtual bool getLine(DisassemblerLine &result, uint32_t &address); 15 | virtual void analyze(uint32_t address); 16 | virtual string getBreakpointBusName(); 17 | virtual uint32_t getCurrentAddress(); 18 | 19 | virtual uint8_t usage(uint32_t address); 20 | virtual uint8_t read(uint32_t address); 21 | virtual void write(uint32_t address, uint8_t data); 22 | 23 | private: 24 | Source source; 25 | 26 | SymbolMap *symbols; 27 | uint8_t *usagePointer; 28 | 29 | uint32_t decode(uint32_t type, uint32_t address, uint32_t pc); 30 | void setOpcodeParams(DisassemblerLine &result, SNES::CPU::Opcode &opcode, uint32_t address); 31 | 32 | }; 33 | -------------------------------------------------------------------------------- /bsnes/ui-qt/settings/input.moc.hpp: -------------------------------------------------------------------------------- 1 | class InputSettingsWindow : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QTreeWidget *list; 7 | QHBoxLayout *controlLayout; 8 | QLabel *message; 9 | QPushButton *optionButton; 10 | QPushButton *assignButton; 11 | QPushButton *unassignButton; 12 | QLabel *buttonBox; 13 | QPushButton *xAxisButton; 14 | QPushButton *yAxisButton; 15 | QPushButton *stopButton; 16 | QCheckBox *modifierEnable; 17 | 18 | void inputEvent(uint16_t scancode); 19 | InputSettingsWindow(); 20 | 21 | private slots: 22 | void synchronize(); 23 | void activateAssign(); 24 | void assign(); 25 | void assignGroup(); 26 | void unassign(); 27 | void unassignGroup(); 28 | void xAxisAssign(); 29 | void yAxisAssign(); 30 | void stop(); 31 | void toggleModifierEnable(); 32 | 33 | private: 34 | QTreeWidgetItem *port1, *port2, *userInterface; 35 | array inputTable; 36 | MappedInput *activeInput; 37 | InputGroup *activeGroup; 38 | unsigned groupIndex; 39 | unsigned activeMouse; 40 | 41 | void updateList(); 42 | void setAssignment(string); 43 | void setActiveInput(MappedInput*); 44 | }; 45 | 46 | extern InputSettingsWindow *inputSettingsWindow; 47 | -------------------------------------------------------------------------------- /common/nall/utility.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_UTILITY_HPP 2 | #define NALL_UTILITY_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace nall { 8 | template struct enable_if { typedef T type; }; 9 | template struct enable_if {}; 10 | template struct mp_enable_if : enable_if {}; 11 | 12 | template inline void swap(T &x, T &y) { 13 | T temp(std::move(x)); 14 | x = std::move(y); 15 | y = std::move(temp); 16 | } 17 | 18 | template struct base_from_member { 19 | T value; 20 | base_from_member(T value_) : value(value_) {} 21 | }; 22 | 23 | template class optional { 24 | bool valid; 25 | T value; 26 | public: 27 | inline operator bool() const { return valid; } 28 | inline const T& operator()() const { if(!valid) throw; return value; } 29 | inline optional(bool valid, const T &value) : valid(valid), value(value) {} 30 | }; 31 | 32 | template inline T* allocate(unsigned size, const T &value) { 33 | T *array = new T[size]; 34 | for(unsigned i = 0; i < size; i++) array[i] = value; 35 | return array; 36 | } 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/file/file.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | Copyright (C) 2007 by Nach 3 | http://nsrt.edgeemu.com 4 | 5 | Copyright (C) 2007-2011 by sinamas 6 | sinamas@users.sourceforge.net 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License version 2 as 10 | published by the Free Software Foundation. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License version 2 for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | version 2 along with this program; if not, write to the 19 | Free Software Foundation, Inc., 20 | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 21 | ***************************************************************************/ 22 | #include "stdfile.h" 23 | 24 | transfer_ptr gambatte::newFileInstance(std::string const &filepath) { 25 | return transfer_ptr(new StdFile(filepath.c_str())); 26 | } 27 | -------------------------------------------------------------------------------- /bsnes/snes/chip/necdsp/necdsp.hpp: -------------------------------------------------------------------------------- 1 | class NECDSP : public Coprocessor, public Memory { 2 | public: 3 | enum class Revision : unsigned { uPD7725, uPD96050 } revision; 4 | unsigned frequency; 5 | unsigned drmask, drtest; 6 | unsigned srmask, srtest; 7 | unsigned dpmask, dptest; 8 | 9 | #include "registers.hpp" 10 | 11 | uint24 programROM[16384]; 12 | uint16 dataROM[2048]; 13 | uint16 dataRAM[2048]; 14 | 15 | unsigned programROMSize; 16 | unsigned dataROMSize; 17 | unsigned dataRAMSize; 18 | 19 | static void Enter(); 20 | void enter(); 21 | 22 | void exec_op(uint24 opcode); 23 | void exec_rt(uint24 opcode); 24 | void exec_jp(uint24 opcode); 25 | void exec_ld(uint24 opcode); 26 | 27 | string disassemble(uint14 ip); 28 | 29 | uint8 read(unsigned addr); 30 | void write(unsigned addr, uint8 data); 31 | 32 | uint8 sr_read(); 33 | void sr_write(uint8 data); 34 | 35 | uint8 dr_read(); 36 | void dr_write(uint8 data); 37 | 38 | uint8 dp_read(unsigned addr); 39 | void dp_write(unsigned addr, uint8 data); 40 | 41 | void init(); 42 | void enable(); 43 | void power(); 44 | void reset(); 45 | 46 | void serialize(serializer&); 47 | NECDSP(); 48 | ~NECDSP(); 49 | }; 50 | 51 | extern NECDSP necdsp; 52 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/sound/master_disabler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 by sinamas 3 | // 4 | // This program is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License version 2 as 6 | // published by the Free Software Foundation. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License version 2 for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // version 2 along with this program; if not, write to the 15 | // Free Software Foundation, Inc., 16 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 17 | // 18 | 19 | #ifndef MASTER_DISABLER_H 20 | #define MASTER_DISABLER_H 21 | 22 | namespace gambatte { 23 | 24 | class MasterDisabler { 25 | public: 26 | explicit MasterDisabler(bool &master) : master_(master) {} 27 | virtual ~MasterDisabler() {} 28 | virtual void operator()() { master_ = false; } 29 | 30 | private: 31 | bool &master_; 32 | }; 33 | 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /bsnes/thrift/thrift/qt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | set( thriftcppqt5_SOURCES 21 | TQIODeviceTransport.cpp 22 | TQTcpServer.cpp 23 | ) 24 | set(CMAKE_AUTOMOC ON) 25 | find_package(Qt5 REQUIRED COMPONENTS Core Network) 26 | ADD_LIBRARY_THRIFT(thriftqt5 ${thriftcppqt5_SOURCES}) 27 | TARGET_LINK_LIBRARIES_THRIFT(thriftqt5 Qt5::Core Qt5::Network) 28 | TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY(thriftqt5 thrift) 29 | -------------------------------------------------------------------------------- /snesfilter/hq2x/hq2x.hpp: -------------------------------------------------------------------------------- 1 | class HQ2xFilter { 2 | public: 3 | void size(unsigned&, unsigned&, unsigned, unsigned); 4 | void render(uint32_t*, unsigned, const uint16_t*, unsigned, unsigned, unsigned); 5 | 6 | HQ2xFilter(); 7 | ~HQ2xFilter(); 8 | 9 | private: 10 | enum { 11 | diff_offset = (0x440 << 21) + (0x207 << 11) + 0x407, 12 | diff_mask = (0x380 << 21) + (0x1f0 << 11) + 0x3f0, 13 | }; 14 | 15 | static const uint8_t hqTable[256]; 16 | uint32_t *yuvTable; 17 | uint8_t rotate[256]; 18 | 19 | alwaysinline bool same(uint16_t x, uint16_t y); 20 | alwaysinline bool diff(uint32_t x, uint16_t y); 21 | alwaysinline void grow(uint32_t &n); 22 | alwaysinline uint16_t pack(uint32_t n); 23 | alwaysinline uint16_t blend1(uint32_t A, uint32_t B); 24 | alwaysinline uint16_t blend2(uint32_t A, uint32_t B, uint32_t C); 25 | alwaysinline uint16_t blend3(uint32_t A, uint32_t B, uint32_t C); 26 | alwaysinline uint16_t blend4(uint32_t A, uint32_t B, uint32_t C); 27 | alwaysinline uint16_t blend5(uint32_t A, uint32_t B, uint32_t C); 28 | alwaysinline uint16_t blend6(uint32_t A, uint32_t B, uint32_t C); 29 | alwaysinline uint16_t blend(unsigned rule, uint16_t E, uint16_t A, uint16_t B, uint16_t D, uint16_t F, uint16_t H); 30 | } filter_hq2x; 31 | -------------------------------------------------------------------------------- /bsnes/data/default.sa1.sym: -------------------------------------------------------------------------------- 1 | ; default registers used for SA1 (from SA1 side) 2 | 3 | [labels] 4 | 00:2209 SA1.SCNT 5 | 00:220A SA1.CIE 6 | 00:220B SA1.CIC 7 | 00:220C SA1.SNV 8 | 00:220D SA1.SNVH 9 | 00:220E SA1.SIV 10 | 00:220F SA1.SIVH 11 | 00:2210 SA1.TMC 12 | 00:2211 SA1.CTR 13 | 00:2212 SA1.HCNT 14 | 00:2213 SA1.HCNTH 15 | 00:2214 SA1.VCNT 16 | 00:2215 SA1.VCNTH 17 | 00:2225 SA1.BMAP 18 | 00:2227 SA1.CBWE 19 | 00:222A SA1.CIWP 20 | 00:2230 SA1.DCNT 21 | 00:2231 SA1.CDMA 22 | 00:2232 SA1.SDA 23 | 00:2233 SA1.SDAM 24 | 00:2234 SA1.SDAH 25 | 00:2235 SA1.DDA 26 | 00:2236 SA1.DDAM 27 | 00:2237 SA1.DDAH 28 | 00:2238 SA1.DTC 29 | 00:2239 SA1.DTCH 30 | 00:223F SA1.BBF 31 | 00:2240 SA1.BRF0 32 | 00:2241 SA1.BRF1 33 | 00:2242 SA1.BRF2 34 | 00:2243 SA1.BRF3 35 | 00:2244 SA1.BRF4 36 | 00:2245 SA1.BRF5 37 | 00:2246 SA1.BRF6 38 | 00:2247 SA1.BRF7 39 | 00:2248 SA1.BRF8 40 | 00:2249 SA1.BRF9 41 | 00:224A SA1.BRF10 42 | 00:224B SA1.BRF11 43 | 00:224C SA1.BRF12 44 | 00:224D SA1.BRF13 45 | 00:224E SA1.BRF14 46 | 00:224F SA1.BRF15 47 | 00:2301 SA1.CFR 48 | 00:2302 SA1.HCR 49 | 00:2303 SA1.HCRH 50 | 00:2304 SA1.VCR 51 | 00:2305 SA1.VCRH 52 | 00:2306 SA1.MR 53 | 00:2307 SA1.MR1 54 | 00:2308 SA1.MR2 55 | 00:2309 SA1.MR3 56 | 00:230A SA1.MR4 57 | 00:230B SA1.OF 58 | 00:230C SA1.VDP 59 | 00:230D SA1.VDPH 60 | -------------------------------------------------------------------------------- /bsnes/snes/chip/supergameboy/supergameboy.hpp: -------------------------------------------------------------------------------- 1 | class SuperGameBoy : public Coprocessor, public Stream, public Memory, public library { 2 | public: 3 | static void Enter(); 4 | void enter(); 5 | void save(); 6 | 7 | uint8 read(unsigned addr); 8 | void write(unsigned addr, uint8 data); 9 | 10 | void init(); 11 | void enable(); 12 | void power(); 13 | void reset(); 14 | void unload(); 15 | 16 | void serialize(serializer&); 17 | 18 | private: 19 | uint32_t samplebuffer[4096]; 20 | unsigned speed; 21 | 22 | void update_speed(); 23 | 24 | function sgb_rom; 25 | function sgb_ram; 26 | function sgb_rtc; 27 | function sgb_init; 28 | function sgb_term; 29 | function sgb_power; 30 | function sgb_reset; 31 | function sgb_read; 32 | function sgb_write; 33 | function sgb_run; 34 | function sgb_save; 35 | function sgb_serialize; 36 | 37 | friend class Cartridge; 38 | }; 39 | 40 | #if defined(DEBUGGER) 41 | #include "debugger/debugger.hpp" 42 | extern SGBDebugger supergameboy; 43 | #else 44 | extern SuperGameBoy supergameboy; 45 | #endif 46 | -------------------------------------------------------------------------------- /bsnes/ui-qt/base/filebrowser.moc.hpp: -------------------------------------------------------------------------------- 1 | class FileBrowser : public FileDialog { 2 | Q_OBJECT 3 | 4 | public: 5 | function onChange; 6 | function onActivate; 7 | function onAccept; 8 | 9 | void chooseFile(); 10 | void chooseFolder(); 11 | enum CartridgeMode { LoadDirect, LoadBase, LoadSlot1, LoadSlot2 } cartridgeMode; 12 | void loadCartridge(CartridgeMode, signed = -1); 13 | 14 | bool popupOpen() const { return nativeOpen; } 15 | 16 | FileBrowser(); 17 | 18 | private slots: 19 | void change(const string&); 20 | void activate(const string&); 21 | void accept(const string&); 22 | void toggleApplyPatch(); 23 | 24 | private: 25 | QVBoxLayout *previewLayout; 26 | QLabel *previewInfo; 27 | QWidget *previewImage; 28 | QWidget *previewSpacer; 29 | QCheckBox *previewApplyPatch; 30 | 31 | bool nativeOpen; 32 | 33 | string resolveFilename(const string&); 34 | void onChangeCartridge(const string&); 35 | void onAcceptCartridge(const string&); 36 | 37 | void acceptNormal(const string &filename); 38 | void acceptBsx(const string &filename); 39 | void acceptSufamiTurbo(const string &filename); 40 | void acceptSuperGameBoy(const string &filename); 41 | }; 42 | 43 | extern FileBrowser *fileBrowser; 44 | -------------------------------------------------------------------------------- /bsnes/snes/smp/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef SMP_CPP 2 | 3 | void SMP::serialize(serializer &s) { 4 | Processor::serialize(s); 5 | SMPcore::core_serialize(s); 6 | 7 | s.integer(status.internal_speed); 8 | s.integer(status.external_speed); 9 | s.integer(status.timers_enabled); 10 | s.integer(status.ram_disabled); 11 | s.integer(status.ram_writable); 12 | s.integer(status.timers_disabled); 13 | 14 | s.integer(status.iplrom_enabled); 15 | 16 | s.integer(status.dsp_addr); 17 | 18 | s.array(port.cpu_to_smp); 19 | s.array(port.smp_to_cpu); 20 | s.array(port.aux); 21 | 22 | s.integer(t0.stage0_ticks); 23 | s.integer(t0.stage1_ticks); 24 | s.integer(t0.stage2_ticks); 25 | s.integer(t0.stage3_ticks); 26 | s.integer(t0.current_line); 27 | s.integer(t0.enabled); 28 | s.integer(t0.target); 29 | 30 | s.integer(t1.stage0_ticks); 31 | s.integer(t1.stage1_ticks); 32 | s.integer(t1.stage2_ticks); 33 | s.integer(t1.stage3_ticks); 34 | s.integer(t1.current_line); 35 | s.integer(t1.enabled); 36 | s.integer(t1.target); 37 | 38 | s.integer(t2.stage0_ticks); 39 | s.integer(t2.stage1_ticks); 40 | s.integer(t2.stage2_ticks); 41 | s.integer(t2.stage3_ticks); 42 | s.integer(t2.current_line); 43 | s.integer(t2.enabled); 44 | s.integer(t2.target); 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /bsnes/snes/chip/spc7110/decomp.hpp: -------------------------------------------------------------------------------- 1 | class SPC7110Decomp { 2 | public: 3 | uint8 read(); 4 | void init(unsigned mode, unsigned offset, unsigned index); 5 | void reset(); 6 | 7 | void serialize(serializer&); 8 | SPC7110Decomp(); 9 | ~SPC7110Decomp(); 10 | 11 | private: 12 | unsigned decomp_mode; 13 | unsigned decomp_offset; 14 | 15 | //read() will spool chunks half the size of decomp_buffer_size 16 | enum { decomp_buffer_size = 64 }; //must be >= 64, and must be a power of two 17 | uint8 *decomp_buffer; 18 | unsigned decomp_buffer_rdoffset; 19 | unsigned decomp_buffer_wroffset; 20 | unsigned decomp_buffer_length; 21 | 22 | void write(uint8 data); 23 | uint8 dataread(); 24 | 25 | void mode0(bool init); 26 | void mode1(bool init); 27 | void mode2(bool init); 28 | 29 | static const uint8 evolution_table[53][4]; 30 | static const uint8 mode2_context_table[32][2]; 31 | 32 | struct ContextState { 33 | uint8 index; 34 | uint8 invert; 35 | } context[32]; 36 | 37 | uint8 probability(unsigned n); 38 | uint8 next_lps(unsigned n); 39 | uint8 next_mps(unsigned n); 40 | bool toggle_invert(unsigned n); 41 | 42 | unsigned morton16[2][256]; 43 | unsigned morton32[4][256]; 44 | unsigned morton_2x8(unsigned data); 45 | unsigned morton_4x8(unsigned data); 46 | }; 47 | -------------------------------------------------------------------------------- /common/nall/string/platform.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_STRING_PLATFORM_HPP 2 | #define NALL_STRING_PLATFORM_HPP 3 | 4 | namespace nall { 5 | 6 | string realpath(const char *name) { 7 | char path[PATH_MAX]; 8 | if(::realpath(name, path)) { 9 | string result(path); 10 | result.transform("\\", "/"); 11 | if(result.endswith("/") == false) result.append("/"); 12 | return result; 13 | } 14 | return ""; 15 | } 16 | 17 | string userpath() { 18 | char path[PATH_MAX]; 19 | if(::userpath(path)) { 20 | string result(path); 21 | result.transform("\\", "/"); 22 | if(result.endswith("/") == false) result.append("/"); 23 | return result; 24 | } 25 | return ""; 26 | } 27 | 28 | string currentpath() { 29 | char path[PATH_MAX]; 30 | if(::getcwd(path)) { 31 | string result(path); 32 | result.transform("\\", "/"); 33 | if(result.endswith("/") == false) result.append("/"); 34 | return result; 35 | } 36 | return ""; 37 | } 38 | 39 | //override filename's path with filepath, but only if filepath isn't empty 40 | //used for GUI's "path selection" functionality 41 | string filepath(const char *filename, const char *filepath) { 42 | if(!filepath || !*filepath) return filename; 43 | return string() << dir(filepath) << notdir(filename); 44 | } 45 | 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /bsnes/snes/chip/sdd1/sdd1.hpp: -------------------------------------------------------------------------------- 1 | #include "sdd1emu.hpp" 2 | 3 | class SDD1 : public MMIO, public Memory { 4 | public: 5 | void init(); 6 | void enable(); 7 | void power(); 8 | void reset(); 9 | 10 | uint8 mmio_read(unsigned addr); 11 | void mmio_write(unsigned addr, uint8 data); 12 | 13 | uint8 read(unsigned addr); 14 | void write(unsigned addr, uint8 data); 15 | 16 | void serialize(serializer&); 17 | SDD1(); 18 | ~SDD1(); 19 | 20 | private: 21 | MMIO *cpu_mmio[0x80]; //bus spying hooks to glean information for struct dma[] 22 | 23 | uint8 sdd1_enable; //channel bit-mask 24 | uint8 xfer_enable; //channel bit-mask 25 | unsigned mmc[4]; //memory map controller ROM indices 26 | 27 | struct { 28 | unsigned addr; //$43x2-$43x4 -- DMA transfer address 29 | uint16 size; //$43x5-$43x6 -- DMA transfer size 30 | } dma[8]; 31 | 32 | SDD1emu sdd1emu; 33 | struct { 34 | uint8 data[65536]; //pointer to decompressed S-DD1 data 35 | uint16 offset; //read index into S-DD1 decompression buffer 36 | unsigned size; //length of data buffer; reads decrement counter, set ready to false at 0 37 | bool ready; //true when data[] is valid; false to invoke sdd1emu.decompress() 38 | } buffer; 39 | }; 40 | 41 | extern SDD1 sdd1; 42 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/ppu/image-grid-widget.moc.hpp: -------------------------------------------------------------------------------- 1 | 2 | class ImageGridWidget : public QGraphicsView { 3 | Q_OBJECT 4 | 5 | const static QColor GRID_COLOR; 6 | const static QColor SELECTED_INNER_COLOR; 7 | const static QColor SELECTED_OUTER_COLOR; 8 | 9 | public: 10 | ImageGridWidget(); 11 | 12 | void setImage(const QImage& image); 13 | void setZoom(unsigned zoom); 14 | void setGridSize(unsigned gridSize); 15 | 16 | QPoint selected() const; 17 | bool selectionValid() const; 18 | 19 | public slots: 20 | void setShowGrid(bool showGrid); 21 | 22 | void selectNone(); 23 | void setSelected(const QPoint& cell); 24 | 25 | void scrollToCell(const QPoint& cell); 26 | 27 | signals: 28 | void selectedChanged(); 29 | 30 | protected: 31 | void mousePressEvent(QMouseEvent *event); 32 | 33 | void drawForeground(QPainter* painter, const QRectF& rect); 34 | 35 | private: 36 | void drawGrid(QPainter* painter, const QRectF& rect); 37 | void drawSelectedCell(QPainter* painter, const QRectF& rect); 38 | 39 | QPen cosmeticPen(const QColor& color) const; 40 | 41 | private: 42 | bool showGrid; 43 | unsigned zoom; 44 | unsigned gridSize; 45 | 46 | QPoint selectedCell; 47 | 48 | QPixmap pixmap; 49 | 50 | QGraphicsScene *scene; 51 | QGraphicsPixmapItem *scenePixmap; 52 | }; 53 | 54 | -------------------------------------------------------------------------------- /bsnes/ui-qt/utility/utility.hpp: -------------------------------------------------------------------------------- 1 | class Utility { 2 | public: 3 | //utility.cpp 4 | void inputEvent(uint16_t scancode); 5 | void showMessage(const char *message); 6 | void updateSystemState(); 7 | void acquireMouse(); 8 | void unacquireMouse(); 9 | 10 | void updateAvSync(); 11 | void updateAvSync(bool syncVideo, bool syncAudio); 12 | void updateColorFilter(); 13 | void updatePixelShader(); 14 | void updateHardwareFilter(); 15 | void updateSoftwareFilter(); 16 | void updateEmulationSpeed(); 17 | void updateEmulationSpeed(unsigned speed); 18 | void updateControllers(); 19 | 20 | //system-state.cpp 21 | enum system_state_t { LoadCartridge, UnloadCartridge, PowerOn, PowerOff, PowerCycle, Reset, ReloadCartridge }; 22 | void modifySystemState(system_state_t state); 23 | 24 | //window.cpp 25 | void updateFullscreenState(); 26 | void constrainSize(unsigned &x, unsigned &y, unsigned max); 27 | void resizeMainWindow(); 28 | void toggleSynchronizeVideo(); 29 | void toggleSynchronizeAudio(); 30 | void setNtscMode(); 31 | void setPalMode(); 32 | void toggleSmoothVideoOutput(); 33 | void toggleAspectCorrection(); 34 | void setScale(unsigned); 35 | void toggleFullscreen(); 36 | void updateMenubar(); 37 | void updateStatusbar(); 38 | }; 39 | 40 | extern Utility utility; 41 | -------------------------------------------------------------------------------- /snesreader/libjma/lzma.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net ) 3 | Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org ) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License version 2.1 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | */ 18 | 19 | #include "lzma.h" 20 | 21 | namespace NCompress { 22 | namespace NLZMA { 23 | 24 | UINT32 kDistStart[kDistTableSizeMax]; 25 | 26 | static class CConstInit 27 | { 28 | public: 29 | CConstInit() 30 | { 31 | UINT32 aStartValue = 0; 32 | int i; 33 | for (i = 0; i < kDistTableSizeMax; i++) 34 | { 35 | kDistStart[i] = aStartValue; 36 | aStartValue += (1 << kDistDirectBits[i]); 37 | } 38 | } 39 | } g_ConstInit; 40 | 41 | }} 42 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/disassembler/processor/sgb_processor.hpp: -------------------------------------------------------------------------------- 1 | class SgbDisasmProcessor : public DisasmProcessor { 2 | public: 3 | SgbDisasmProcessor(SymbolMap*); 4 | 5 | virtual class SymbolMap *getSymbols(); 6 | 7 | virtual uint32_t getBusSize(); 8 | virtual uint32_t findStartLineAddress(uint32_t currentAddress, uint32_t linesBelow); 9 | virtual void findKnownRange(uint32_t currentAddress, uint32_t &startAddress, uint32_t &endAddress, uint32_t ¤tAddressLine, uint32_t &numLines); 10 | virtual bool getLine(DisassemblerLine &result, uint32_t &address); 11 | virtual void analyze(uint32_t address); 12 | virtual string getBreakpointBusName(); 13 | virtual uint32_t getCurrentAddress(); 14 | 15 | virtual uint8_t usage(uint32_t address); 16 | virtual uint8_t read(uint32_t address); 17 | virtual void write(uint32_t address, uint8_t data); 18 | 19 | private: 20 | SymbolMap *symbols; 21 | uint8_t *usagePointer; 22 | 23 | uint32_t decode(unsigned type, uint16_t address, uint16_t pc); 24 | uint32_t decode(SNES::SGBDebugger::Opcode &opcode, uint16_t pc); 25 | void setOpcodePartParams(DisassemblerLine &result, unsigned part, SNES::SGBDebugger::Opcode &opcode, uint16_t address); 26 | void setOpcodeParams(DisassemblerLine &result, SNES::SGBDebugger::Opcode &opcode, uint16_t address); 27 | 28 | }; 29 | -------------------------------------------------------------------------------- /bsnes/thrift/thrift/protocol/TProtocolTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #ifndef THRIFT_PROTOCOL_TPROTOCOLTYPES_H_ 21 | #define THRIFT_PROTOCOL_TPROTOCOLTYPES_H_ 1 22 | 23 | namespace apache { 24 | namespace thrift { 25 | namespace protocol { 26 | 27 | enum PROTOCOL_TYPES { 28 | T_BINARY_PROTOCOL = 0, 29 | T_JSON_PROTOCOL = 1, 30 | T_COMPACT_PROTOCOL = 2, 31 | }; 32 | } 33 | } 34 | } // apache::thrift::protocol 35 | 36 | #endif // #define _THRIFT_PROTOCOL_TPROTOCOLTYPES_H_ 1 37 | -------------------------------------------------------------------------------- /bsnes/ui-qt/tools/cheatfinder.moc.hpp: -------------------------------------------------------------------------------- 1 | class CheatFinderWindow : public QWidget { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QTreeWidget *list; 7 | QGridLayout *controlLayout; 8 | QLabel *sizeLabel; 9 | QButtonGroup *sizeGroup; 10 | QRadioButton *size8bit; 11 | QRadioButton *size16bit; 12 | QRadioButton *size24bit; 13 | QRadioButton *size32bit; 14 | QLabel *compareLabel; 15 | QButtonGroup *compareGroup; 16 | QRadioButton *compareEqual; 17 | QRadioButton *compareNotEqual; 18 | QRadioButton *compareLessThan; 19 | QRadioButton *compareGreaterThan; 20 | QLabel *valueLabel; 21 | QHBoxLayout *actionLayout; 22 | QLineEdit *valueEdit; 23 | QPushButton *searchButton; 24 | QPushButton *resetButton; 25 | 26 | QButtonGroup *compareToGroup; 27 | QLabel *compareToLabel; 28 | QRadioButton *compareToPrev; 29 | QRadioButton *compareToAddress; 30 | QRadioButton *compareToValue; 31 | 32 | void synchronize(); 33 | void refreshList(); 34 | CheatFinderWindow(); 35 | 36 | public slots: 37 | void toggle_editline(bool); 38 | void searchMemory(); 39 | void resetSearch(); 40 | 41 | private: 42 | array addrList; 43 | array dataList; 44 | 45 | unsigned read(unsigned addr, unsigned size); 46 | }; 47 | 48 | extern CheatFinderWindow *cheatFinderWindow; 49 | -------------------------------------------------------------------------------- /bsnes/snes/chip/necdsp/serialization.cpp: -------------------------------------------------------------------------------- 1 | #ifdef NECDSP_CPP 2 | 3 | void NECDSP::serialize(serializer &s) { 4 | s.array(dataRAM); 5 | 6 | s.array(regs.stack); 7 | s.integer(regs.pc); 8 | s.integer(regs.rp); 9 | s.integer(regs.dp); 10 | s.integer(regs.sp); 11 | 12 | s.integer(regs.k); 13 | s.integer(regs.l); 14 | s.integer(regs.m); 15 | s.integer(regs.n); 16 | s.integer(regs.a); 17 | s.integer(regs.b); 18 | 19 | s.integer(regs.flaga.s1); 20 | s.integer(regs.flaga.s0); 21 | s.integer(regs.flaga.c); 22 | s.integer(regs.flaga.z); 23 | s.integer(regs.flaga.ov1); 24 | s.integer(regs.flaga.ov0); 25 | 26 | s.integer(regs.flagb.s1); 27 | s.integer(regs.flagb.s0); 28 | s.integer(regs.flagb.c); 29 | s.integer(regs.flagb.z); 30 | s.integer(regs.flagb.ov1); 31 | s.integer(regs.flagb.ov0); 32 | 33 | s.integer(regs.tr); 34 | s.integer(regs.trb); 35 | 36 | s.integer(regs.sr.rqm); 37 | s.integer(regs.sr.usf1); 38 | s.integer(regs.sr.usf0); 39 | s.integer(regs.sr.drs); 40 | s.integer(regs.sr.dma); 41 | s.integer(regs.sr.drc); 42 | s.integer(regs.sr.soc); 43 | s.integer(regs.sr.sic); 44 | s.integer(regs.sr.ei); 45 | s.integer(regs.sr.p1); 46 | s.integer(regs.sr.p0); 47 | 48 | s.integer(regs.dr); 49 | s.integer(regs.si); 50 | s.integer(regs.so); 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/src/state_osd_elements.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2008 by sinamas 3 | // 4 | // This program is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License version 2 as 6 | // published by the Free Software Foundation. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License version 2 for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // version 2 along with this program; if not, write to the 15 | // Free Software Foundation, Inc., 16 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 17 | // 18 | 19 | #ifndef STATE_OSD_ELEMENTS_H 20 | #define STATE_OSD_ELEMENTS_H 21 | 22 | #include "osd_element.h" 23 | #include "transfer_ptr.h" 24 | 25 | #include 26 | 27 | namespace gambatte { 28 | transfer_ptr newStateLoadedOsdElement(unsigned stateNo); 29 | transfer_ptr newStateSavedOsdElement(unsigned stateNo); 30 | transfer_ptr newSaveStateOsdElement(const std::string &fileName, unsigned stateNo); 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /bsnes/ui-qt/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ui-base.hpp" 2 | #include "resource.rcc" 3 | 4 | #if defined(PLATFORM_X) 5 | #include "platform/platform_x.cpp" 6 | const char Style::Monospace[64] = "monospace"; 7 | #elif defined(PLATFORM_OSX) 8 | #include "platform/platform_osx.cpp" 9 | const char Style::Monospace[64] = "Courier New"; 10 | #elif defined(PLATFORM_WIN) 11 | #include "platform/platform_win.cpp" 12 | const char Style::Monospace[64] = "Lucida Console"; 13 | #else 14 | #error "unsupported platform" 15 | #endif 16 | 17 | #include "config.cpp" 18 | #include "interface.cpp" 19 | 20 | const char defaultStylesheet[] = 21 | "#backdrop {" 22 | " background: #000000;" 23 | "}\n"; 24 | 25 | #include "check-action.moc" 26 | #include "check-delegate.moc" 27 | #include "combo-delegate.moc" 28 | #include "file-dialog.moc" 29 | #include "radio-action.moc" 30 | #include "window.moc" 31 | 32 | #include "application/application.cpp" 33 | #include "link/filter.cpp" 34 | #include "link/music.cpp" 35 | #include "link/reader.cpp" 36 | #include "utility/utility.cpp" 37 | 38 | int main(int argc, char **argv) { 39 | return application.main(argc, argv); 40 | } 41 | 42 | #pragma comment(linker,"\"/manifestdependency:type='win32' \ 43 | name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ 44 | processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 45 | -------------------------------------------------------------------------------- /bsnes/thrift/thrift/TBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #ifndef _THRIFT_TBASE_H_ 21 | #define _THRIFT_TBASE_H_ 1 22 | 23 | #include 24 | #include 25 | 26 | namespace apache { 27 | namespace thrift { 28 | 29 | class TBase { 30 | public: 31 | virtual ~TBase() = default; 32 | virtual uint32_t read(protocol::TProtocol* iprot) = 0; 33 | virtual uint32_t write(protocol::TProtocol* oprot) const = 0; 34 | }; 35 | } 36 | } // apache::thrift 37 | 38 | #endif // #ifndef _THRIFT_TBASE_H_ 39 | -------------------------------------------------------------------------------- /bsnes/thrift/thrift/windows/SocketPair.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #ifndef _THRIFT_WINDOWS_SOCKETPAIR_H_ 21 | #define _THRIFT_WINDOWS_SOCKETPAIR_H_ 1 22 | 23 | #if defined(_MSC_VER) && (_MSC_VER > 1200) 24 | #pragma once 25 | #endif // _MSC_VER 26 | 27 | #ifndef _WIN32 28 | #error This is a MSVC header only. 29 | #endif 30 | 31 | // Win32 32 | #include 33 | #include 34 | 35 | int thrift_socketpair(int d, int type, int protocol, THRIFT_SOCKET sv[2]); 36 | 37 | #endif // _THRIFT_WINDOWS_SOCKETPAIR_H_ 38 | -------------------------------------------------------------------------------- /supergameboy/libgambatte/include/inputgetter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2007 by sinamas 3 | // 4 | // This program is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License version 2 as 6 | // published by the Free Software Foundation. 7 | // 8 | // This program is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License version 2 for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // version 2 along with this program; if not, write to the 15 | // Free Software Foundation, Inc., 16 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 17 | // 18 | 19 | #ifndef GAMBATTE_INPUTGETTER_H 20 | #define GAMBATTE_INPUTGETTER_H 21 | 22 | namespace gambatte { 23 | 24 | class InputGetter { 25 | public: 26 | enum Button { A = 0x01, B = 0x02, SELECT = 0x04, START = 0x08, 27 | RIGHT = 0x10, LEFT = 0x20, UP = 0x40, DOWN = 0x80 }; 28 | 29 | virtual ~InputGetter() {} 30 | 31 | /** @return A|B|SELECT|START|RIGHT|LEFT|UP|DOWN if those buttons are pressed. */ 32 | virtual unsigned operator()() = 0; 33 | }; 34 | 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /bsnes/snes/chip/sa1/debugger/debugger.hpp: -------------------------------------------------------------------------------- 1 | class SA1Debugger : public SA1, public ChipDebugger { 2 | public: 3 | bool property(unsigned id, string &name, string &value); 4 | 5 | enum { 6 | RegisterPC, 7 | RegisterA, 8 | RegisterX, 9 | RegisterY, 10 | RegisterS, 11 | RegisterD, 12 | RegisterDB, 13 | RegisterP, 14 | }; 15 | unsigned getRegister(unsigned id); 16 | void setRegister(unsigned id, unsigned value); 17 | 18 | enum { 19 | FlagE, 20 | FlagN, 21 | FlagV, 22 | FlagM, 23 | FlagX, 24 | FlagD, 25 | FlagI, 26 | FlagZ, 27 | FlagC, 28 | }; 29 | bool getFlag(unsigned id); 30 | void setFlag(unsigned id, bool value); 31 | 32 | function step_event; 33 | 34 | enum Usage { 35 | UsageRead = 0x80, 36 | UsageWrite = 0x40, 37 | UsageExec = 0x20, 38 | UsageOpcode = 0x10, 39 | UsageFlagM = 0x02, 40 | UsageFlagX = 0x01, 41 | }; 42 | uint8 *usage; 43 | uint8 **cart_usage; 44 | 45 | uint24 opcode_pc; //points to the current opcode, used to backtrace on read/write breakpoints 46 | 47 | void interrupt(uint16 vector); 48 | void op_step(); 49 | uint8_t op_readpc(); 50 | uint8 op_read(uint32 addr); 51 | void op_write(uint32 addr, uint8 data); 52 | 53 | uint8 disassembler_read(uint32 addr); 54 | 55 | SA1Debugger(); 56 | ~SA1Debugger(); 57 | }; 58 | -------------------------------------------------------------------------------- /bsnes/snes/dsp/counter.cpp: -------------------------------------------------------------------------------- 1 | #ifdef DSP_CPP 2 | 3 | //counter_rate = number of samples per counter event 4 | //all rates are evenly divisible by counter_range (0x7800, 30720, or 2048 * 5 * 3) 5 | //note that rate[0] is a special case, which never triggers 6 | 7 | const uint16 DSP::counter_rate[32] = { 8 | 0, 2048, 1536, 9 | 1280, 1024, 768, 10 | 640, 512, 384, 11 | 320, 256, 192, 12 | 160, 128, 96, 13 | 80, 64, 48, 14 | 40, 32, 24, 15 | 20, 16, 12, 16 | 10, 8, 6, 17 | 5, 4, 3, 18 | 2, 19 | 1, 20 | }; 21 | 22 | //counter_offset = counter offset from zero 23 | //counters do not appear to be aligned at zero for all rates 24 | 25 | const uint16 DSP::counter_offset[32] = { 26 | 0, 0, 1040, 27 | 536, 0, 1040, 28 | 536, 0, 1040, 29 | 536, 0, 1040, 30 | 536, 0, 1040, 31 | 536, 0, 1040, 32 | 536, 0, 1040, 33 | 536, 0, 1040, 34 | 536, 0, 1040, 35 | 536, 0, 1040, 36 | 0, 37 | 0, 38 | }; 39 | 40 | inline void DSP::counter_tick() { 41 | state.counter--; 42 | if(state.counter < 0) state.counter = counter_range - 1; 43 | } 44 | 45 | //return true if counter event should trigger 46 | 47 | inline bool DSP::counter_poll(unsigned rate) { 48 | if(rate == 0) return false; 49 | return (((unsigned)state.counter + counter_offset[rate]) % counter_rate[rate]) == 0; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /bsnes/ui-qt/base/loader.moc.hpp: -------------------------------------------------------------------------------- 1 | class LoaderWindow : public Window { 2 | Q_OBJECT 3 | 4 | public: 5 | QVBoxLayout *layout; 6 | QGridLayout *grid; 7 | QLabel *baseLabel; 8 | QLineEdit *baseFile; 9 | QPushButton *baseBrowse; 10 | QPushButton *baseClear; 11 | QLabel *slot1Label; 12 | QLineEdit *slot1File; 13 | QPushButton *slot1Browse; 14 | QPushButton *slot1Clear; 15 | QLabel *slot2Label; 16 | QLineEdit *slot2File; 17 | QPushButton *slot2Browse; 18 | QPushButton *slot2Clear; 19 | QPushButton *load; 20 | QPushButton *cancel; 21 | 22 | void syncUi(); 23 | void loadBsxSlottedCartridge(const char*, const char*); 24 | void loadBsxCartridge(const char*, const char*); 25 | void loadSufamiTurboCartridge(const char*, const char*, const char*); 26 | void loadSuperGameBoyCartridge(const char*, const char*); 27 | LoaderWindow(); 28 | 29 | void selectBaseCartridge(const char*); 30 | void selectSlot1Cartridge(const char*); 31 | void selectSlot2Cartridge(const char*); 32 | 33 | public slots: 34 | void selectBaseCartridge(); 35 | void clearBaseCartridge(); 36 | void selectSlot1Cartridge(); 37 | void clearSlot1Cartridge(); 38 | void selectSlot2Cartridge(); 39 | void clearSlot2Cartridge(); 40 | void onLoad(); 41 | 42 | private: 43 | SNES::Cartridge::Mode mode; 44 | void showWindow(const char *title); 45 | }; 46 | 47 | extern LoaderWindow *loaderWindow; 48 | -------------------------------------------------------------------------------- /bsnes/ui-qt/debugger/ppu/tilemap-viewer.moc.hpp: -------------------------------------------------------------------------------- 1 | 2 | class TilemapViewer : public Window { 3 | Q_OBJECT 4 | 5 | public: 6 | TilemapViewer(); 7 | void autoUpdate(); 8 | 9 | public slots: 10 | void show(); 11 | void refresh(); 12 | 13 | void onZoomChanged(int); 14 | void onExportClicked(); 15 | 16 | private: 17 | void updateRendererSettings(); 18 | void updateForm(); 19 | void updateTileInfo(); 20 | void updateTileInfoNormal(); 21 | void updateTileInfoMode7(); 22 | 23 | private: 24 | TilemapRenderer renderer; 25 | 26 | QHBoxLayout *layout; 27 | QFormLayout *sidebarLayout; 28 | QHBoxLayout *buttonLayout; 29 | QHBoxLayout *bgLayout; 30 | 31 | QCheckBox *autoUpdateBox; 32 | 33 | QPushButton *exportButton; 34 | QPushButton *refreshButton; 35 | 36 | QComboBox *zoomCombo; 37 | QCheckBox *showGrid; 38 | 39 | QCheckBox *customScreenMode; 40 | QCheckBox *customTilemap; 41 | 42 | QSpinBox *screenMode; 43 | QToolButton *bgButtons[4]; 44 | QComboBox *bitDepth; 45 | QComboBox *screenSize; 46 | QComboBox *tileSize; 47 | QLineEdit *tileAddr; 48 | QLineEdit *screenAddr; 49 | 50 | QCheckBox *overrideBackgroundColor; 51 | QComboBox *customBgColorCombo; 52 | 53 | QLabel *tileInfo; 54 | 55 | ImageGridWidget *imageGridWidget; 56 | 57 | bool inUpdateFormCall; 58 | bool inExportClickedCall; 59 | }; 60 | 61 | extern TilemapViewer *tilemapViewer; 62 | -------------------------------------------------------------------------------- /bsnes/Snesida/ida_debmod.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // 5 | // This is the base debmod_t class definition 6 | // From this class all debugger code must inherite and specialize 7 | // 8 | // Some OS specific functions must be implemented: 9 | // bool init_subsystem(); 10 | // bool term_subsystem(); 11 | // debmod_t *create_debug_session(); 12 | // int create_thread(thread_cb_t thread_cb, void *context); 13 | // 14 | 15 | #undef INLINE 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | //-------------------------------------------------------------------------- 22 | // Very simple class to store pending events 23 | enum queue_pos_t 24 | { 25 | IN_FRONT, 26 | IN_BACK 27 | }; 28 | 29 | struct eventlist_t : public std::deque 30 | { 31 | private: 32 | bool synced; 33 | public: 34 | // save a pending event 35 | void enqueue(const debug_event_t &ev, queue_pos_t pos) 36 | { 37 | if (pos != IN_BACK) 38 | push_front(ev); 39 | else 40 | push_back(ev); 41 | } 42 | 43 | // retrieve a pending event 44 | bool retrieve(debug_event_t *event) 45 | { 46 | if (empty()) 47 | return false; 48 | // get the first event and return it 49 | *event = front(); 50 | pop_front(); 51 | return true; 52 | } 53 | }; 54 | -------------------------------------------------------------------------------- /common/nall/string/strl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NALL_STRING_STRL_HPP 2 | #define NALL_STRING_STRL_HPP 3 | 4 | namespace nall { 5 | 6 | //strlcpy, strlcat based on OpenBSD implementation by Todd C. Miller 7 | 8 | //return = strlen(src) 9 | unsigned strlcpy(char *dest, const char *src, unsigned length) { 10 | char *d = dest; 11 | const char *s = src; 12 | unsigned n = length; 13 | 14 | if(n) { 15 | while(--n && (*d++ = *s++)); //copy as many bytes as possible, or until null terminator reached 16 | } 17 | 18 | if(!n) { 19 | if(length) *d = 0; 20 | while(*s++); //traverse rest of s, so that s - src == strlen(src) 21 | } 22 | 23 | return (s - src - 1); //return length of copied string, sans null terminator 24 | } 25 | 26 | //return = strlen(src) + min(length, strlen(dest)) 27 | unsigned strlcat(char *dest, const char *src, unsigned length) { 28 | char *d = dest; 29 | const char *s = src; 30 | unsigned n = length; 31 | 32 | while(n-- && *d) d++; //find end of dest 33 | unsigned dlength = d - dest; 34 | n = length - dlength; //subtract length of dest from maximum string length 35 | 36 | if(!n) return dlength + strlen(s); 37 | 38 | while(*s) { 39 | if(n != 1) { 40 | *d++ = *s; 41 | n--; 42 | } 43 | s++; 44 | } 45 | *d = 0; 46 | 47 | return dlength + (s - src); //return length of resulting string, sans null terminator 48 | } 49 | 50 | } 51 | 52 | #endif 53 | --------------------------------------------------------------------------------