├── .gitignore ├── BBA_Readme.md ├── Build.bat ├── Build.sh ├── Makefile ├── NEWS.md ├── README.md ├── codehandler ├── Makefile ├── codehandler.s └── codehandleronly.s ├── common └── include │ ├── CommonConfig.h │ ├── CommonConfigStrings.h │ ├── Metadata.h │ └── NintendontVersion.h ├── controllerconfigs ├── HID_Test.dol ├── Saitek_P990_Dual_Analog_pad.ini ├── controller_8Bitdo_NES30_Pro.ini ├── controller_8Bitdo_SNES30_Pro.ini ├── controller_CronusMax_Xbox360_Adapter.ini ├── controller_Generic_GC Controller Adapter.ini ├── controller_Generic_USB_Gamepad_PID=0810_VID=e501.ini ├── controller_Genius_MaxFire G-12UV.ini ├── controller_Genreic_USB_Gamepad_PID=0079_VID=0006.ini ├── controller_Gioteck_SC-1.ini ├── controller_Gravis_Eliminator_AfterShock.ini ├── controller_Gravis_Eliminator_GamePad_Pro.ini ├── controller_Hori_Real_Arcade_Pro_3_SA.ini ├── controller_Logitech_Cordless_Rumblepad_2.ini ├── controller_Logitech_F310.ini ├── controller_Logitech_RumblePad_2_and_Rumble_Gamepad_F510.ini ├── controller_Mayflash_3_in_1_Magic_Joy_Box.ini ├── controller_Mayflash_wiiccprousb-PC045.ini ├── controller_Mayflash_wiiccusb-PC052.ini ├── controller_Microsoft_Sidewinder_Forcefeedback_2_Joystick.ini ├── controller_Microsoft_Sidewinder_Precision_2_Joystick.ini ├── controller_Nintendo_Wii_U_GameCube_Adapter.ini ├── controller_Nvidia_Shield.ini ├── controller_PDP_Afterglow_AP_1_Controller_for_PS3.ini ├── controller_PowerA_Wired_PS3.ini ├── controller_Qanba_Drone_N2.ini ├── controller_Thrustmaster_Dual_Analog_4.ini ├── controller_Thrustmaster_Firestorm_Dual_Analog_2.ini ├── controller_Thrustmaster_T-Wireless.ini ├── controller_Trio_Linker_Plus_II.ini ├── controller_Trust_Predator_Gamepad.ini ├── controller_UnderControl_Switch.ini ├── controller_brook_ps3_4_fighting_board.ini ├── controller_brook_zero_pi_easy.ini ├── controller_ini_to_array.exe ├── controller_ini_to_array │ ├── build.bat │ └── main.c ├── controller_ps2.ini ├── controller_ps3.ini ├── controller_ps4.ini ├── controller_ps4v2.ini ├── controller_ps5.ini ├── controller_ps5_edge.ini ├── controller_psx_ps2_splitter.ini ├── controller_switch_gamecube.ini ├── controllers.zip ├── nintendont_triolinker1.ini └── nintendont_wiiuprousb.ini ├── fatfs ├── 00history.txt ├── 00readme.txt ├── Makefile.arm ├── Makefile.ppc ├── diskio.h ├── ff.c ├── ff.h ├── ff_utf8.c ├── ff_utf8.h ├── ffconf.h ├── integer.h └── option │ └── ccsbcs.c ├── kernel ├── BT.c ├── BT.h ├── Config.c ├── Config.h ├── DI.c ├── DI.h ├── ES.c ├── ES.h ├── EXI.c ├── EXI.h ├── FST.c ├── FST.h ├── GCAM.c ├── GCAM.h ├── GCNCard.c ├── GCNCard.h ├── GCPad.h ├── HID.c ├── HID.h ├── HID_controllers.h ├── ISO.c ├── ISO.h ├── JVSIO.c ├── JVSIO.h ├── JVSIOMessage.c ├── JVSIOMessage.h ├── Makefile ├── NAND.c ├── NAND.h ├── NinPattern │ ├── NinPattern.exe │ ├── README.md │ ├── main.c │ └── make_ninpattern.bat ├── PS3Controller.h ├── Patch.c ├── Patch.h ├── PatchCodes.h ├── PatchTimers.c ├── PatchTimers.h ├── PatchWidescreen.c ├── PatchWidescreen.h ├── ReadSpeed.c ├── ReadSpeed.h ├── RealDI.c ├── RealDI.h ├── SDI.c ├── SDI.h ├── SI.c ├── SI.h ├── SRAM.c ├── SRAM.h ├── Stream.c ├── Stream.h ├── TRI.c ├── TRI.h ├── WPad.h ├── adp.c ├── adp.h ├── alloc.c ├── alloc.h ├── asm │ ├── ARQPostRequest.S │ ├── ARStartDMA.S │ ├── ARStartDMA_Hook.S │ ├── ARStartDMA_PM.S │ ├── ARStartDMA_TC.S │ ├── CalcGXWidescreen.S │ ├── CalcWidescreen.S │ ├── CalcWidescreenDiv.S │ ├── CheckTestMenu.S │ ├── CheckTestMenuGP.S │ ├── CheckTestMenuVS.S │ ├── CheckTestMenuYakyuu.S │ ├── DHCP_get_dns.S │ ├── DHCP_get_gateway.S │ ├── DHCP_release.S │ ├── DHCP_request_nb.S │ ├── DVDSendCMDEncrypted.S │ ├── DatelTimer.S │ ├── EXIDMA.S │ ├── EXIGetID.S │ ├── EXIImm.S │ ├── EXILock.S │ ├── EXIProbe.S │ ├── EXISelect.S │ ├── FakeAIInterrupt.S │ ├── FakeEntryLoad.S │ ├── FakeInterrupt.S │ ├── FakeInterrupt_DBG.S │ ├── FakeInterrupt_Datel.S │ ├── FakeRSWLoad.S │ ├── FakeRSWStore.S │ ├── GCAMSendCommand.S │ ├── GXInitTlutObj.S │ ├── GXLoadTlut.S │ ├── HSPIntrruptHandler.S │ ├── IPClearConfigError.S │ ├── IPGetAddr.S │ ├── IPGetConfigError.S │ ├── IPGetLinkState.S │ ├── IPGetMacAddr.S │ ├── IPGetMtu.S │ ├── IPGetNetmask.S │ ├── IPSetConfigError.S │ ├── KeyboardRead.S │ ├── MajoraAudioStream.S │ ├── MajoraLoadRegs.S │ ├── MajoraSaveRegs.S │ ├── Makefile │ ├── OSExceptionInit.S │ ├── OSReportDM.S │ ├── PADControlAllMotors.S │ ├── PADControlMotor.S │ ├── PADControlMotorGP.S │ ├── PADIsBarrel.S │ ├── PADRead.S │ ├── PADReadF.S │ ├── PADReadGP.S │ ├── PADReadVS.S │ ├── PADReadVS3.S │ ├── ReadROM.S │ ├── RestoreSettingsAX_RVC.S │ ├── RestoreSettingsAX_RVD.S │ ├── RestoreSettingsAX_RVE.S │ ├── RestoreSettingsVS3V02.S │ ├── RestoreSettingsVS4EXP.S │ ├── RestoreSettingsVS4JAP.S │ ├── RestoreSettingsVS4V06EXP.S │ ├── RestoreSettingsVS4V06JAP.S │ ├── RestoreSettingsYAKRVB.S │ ├── RestoreSettingsYAKRVC.S │ ├── Return0.S │ ├── Return1.S │ ├── ReturnMinus1.S │ ├── SIGetType.S │ ├── SIInitStore.S │ ├── SIIntrruptHandler.S │ ├── SITransfer.S │ ├── SOAccept.S │ ├── SOBind.S │ ├── SOCleanup.S │ ├── SOClose.S │ ├── SOConnect.S │ ├── SOFcntl.S │ ├── SOInit.S │ ├── SOListen.S │ ├── SOPoll.S │ ├── SORecvFrom.S │ ├── SOSendTo.S │ ├── SOSetSockOpt.S │ ├── SOShutdown.S │ ├── SOSocket.S │ ├── SOStartup.S │ ├── SonicRidersCopy.S │ ├── SwitcherPrs.S │ ├── TCIntrruptHandler.S │ ├── __ARHandler.S │ ├── __CARDClearStatus.S │ ├── __CARDReadStatus.S │ ├── __DSPHandler.S │ ├── __DVDInterruptHandler.S │ ├── __GXSetVAT.S │ ├── avetcp_init.S │ ├── avetcp_term.S │ ├── codehandler_stub.S │ ├── constants.inc │ ├── dns_clear_server.S │ ├── dns_close.S │ ├── dns_get_addr.S │ ├── dns_open_addr.S │ ├── dns_set_server.S │ ├── patch_fwrite_GC.S │ ├── patch_fwrite_Log.S │ ├── tcp_abort.S │ ├── tcp_accept.S │ ├── tcp_bind.S │ ├── tcp_connect.S │ ├── tcp_create.S │ ├── tcp_delete.S │ ├── tcp_getaddr.S │ ├── tcp_listen.S │ ├── tcp_receive.S │ ├── tcp_send.S │ └── tcp_stat.S ├── be │ ├── COPYING.RUNTIME │ ├── COPYING3 │ ├── README │ ├── libc.a │ └── libgcc.a ├── bin2h │ ├── bin2h │ ├── bin2h.exe │ ├── main.c │ ├── make.cmd │ └── make.sh ├── bmp.h ├── common.c ├── common.h ├── debug.h ├── diskio.c ├── dol.h ├── elf.h ├── global.h ├── hidmem.h ├── ipc.h ├── kernel.ld ├── lwbt │ ├── bd_addr.h │ ├── bt.h │ ├── btarch.h │ ├── bte.c │ ├── bte.h │ ├── btmemb.c │ ├── btmemb.h │ ├── btmemr.c │ ├── btmemr.h │ ├── btopt.h │ ├── btpbuf.c │ ├── btpbuf.h │ ├── hci.c │ ├── hci.h │ ├── l2cap.c │ ├── l2cap.h │ ├── libogc_license.txt │ ├── physbusif.c │ └── physbusif.h ├── main.c ├── patches.c ├── prs.c ├── sock.c ├── sock.h ├── start.s ├── string.c ├── string.h ├── syscalls.h ├── syscalls.s ├── usb.c ├── usb.h ├── usbstorage.c ├── usbstorage.h ├── utils_asm.S ├── vsprintf.c ├── vsprintf.h ├── wdvd.c ├── wdvd.h └── zip │ ├── LICENSE │ └── zip.exe ├── kernelboot ├── Makefile ├── _start.S ├── main.c ├── syscalls.h └── syscalls.s ├── loader ├── Makefile ├── data │ ├── background.png │ └── font.zip ├── extlibs │ ├── include │ │ ├── freetype │ │ │ ├── config │ │ │ │ ├── ftconfig.h │ │ │ │ ├── ftheader.h │ │ │ │ ├── ftmodule.h │ │ │ │ ├── ftoption.h │ │ │ │ └── ftstdlib.h │ │ │ ├── freetype.h │ │ │ ├── ftadvanc.h │ │ │ ├── ftautoh.h │ │ │ ├── ftbbox.h │ │ │ ├── ftbdf.h │ │ │ ├── ftbitmap.h │ │ │ ├── ftbzip2.h │ │ │ ├── ftcache.h │ │ │ ├── ftcffdrv.h │ │ │ ├── ftchapters.h │ │ │ ├── ftcid.h │ │ │ ├── fterrdef.h │ │ │ ├── fterrors.h │ │ │ ├── ftgasp.h │ │ │ ├── ftglyph.h │ │ │ ├── ftgxval.h │ │ │ ├── ftgzip.h │ │ │ ├── ftimage.h │ │ │ ├── ftincrem.h │ │ │ ├── ftlcdfil.h │ │ │ ├── ftlist.h │ │ │ ├── ftlzw.h │ │ │ ├── ftmac.h │ │ │ ├── ftmm.h │ │ │ ├── ftmodapi.h │ │ │ ├── ftmoderr.h │ │ │ ├── ftotval.h │ │ │ ├── ftoutln.h │ │ │ ├── ftpfr.h │ │ │ ├── ftrender.h │ │ │ ├── ftsizes.h │ │ │ ├── ftsnames.h │ │ │ ├── ftstroke.h │ │ │ ├── ftsynth.h │ │ │ ├── ftsystem.h │ │ │ ├── fttrigon.h │ │ │ ├── fttypes.h │ │ │ ├── ftwinfnt.h │ │ │ ├── ftxf86.h │ │ │ ├── t1tables.h │ │ │ ├── ttnameid.h │ │ │ ├── tttables.h │ │ │ ├── tttags.h │ │ │ └── ttunpat.h │ │ ├── ft2build.h │ │ ├── png.h │ │ ├── pngconf.h │ │ ├── pngu.h │ │ ├── wiidrc │ │ │ └── wiidrc.h │ │ ├── wupc │ │ │ └── wupc.h │ │ ├── zconf.h │ │ └── zlib.h │ └── lib │ │ ├── libfreetype.a │ │ ├── libpng.a │ │ ├── libpngu.a │ │ ├── libwiidrc.a │ │ ├── libwupc.a │ │ └── libz.a ├── include │ ├── Config.h │ ├── ELF.h │ ├── FPad.h │ ├── HID.h │ ├── MemCard.h │ ├── Patches.h │ ├── ShowGameInfo.h │ ├── TRI.h │ ├── dip.h │ ├── exi.h │ ├── ff_cache │ │ ├── bit_ops.h │ │ ├── cache.h │ │ ├── common.h │ │ ├── disc.h │ │ └── mem_allocate.h │ ├── font.h │ ├── global.h │ ├── grrlib.h │ ├── http.h │ ├── ipl.h │ ├── md5.h │ ├── md5_db.h │ ├── menu.h │ ├── ssl.h │ ├── titles.h │ ├── update.h │ ├── usb_ogc.h │ ├── usbstorage_ogc.h │ ├── verify_md5.h │ └── wdvd.h ├── loader.dol └── source │ ├── FPad.c │ ├── HID.c │ ├── MemCard.c │ ├── Patches.c │ ├── ShowGameInfo.c │ ├── TRI.c │ ├── dip.c │ ├── diskio.c │ ├── exi.c │ ├── ff_cache.c │ ├── font.c │ ├── global.c │ ├── grrlib.c │ ├── http.c │ ├── ipl.c │ ├── jmp813.S │ ├── main.c │ ├── md5.c │ ├── md5_db.c │ ├── menu.c │ ├── ppc │ ├── IOSInterface │ │ ├── Makefile │ │ ├── include │ │ │ ├── cache.h │ │ │ └── sock.h │ │ ├── link.ld │ │ └── source │ │ │ ├── _crt0.S │ │ │ ├── cache.c │ │ │ └── sock.c │ └── PADReadGC │ │ ├── Makefile │ │ ├── include │ │ ├── HID.h │ │ ├── PS3Controller.h │ │ ├── global.h │ │ ├── hidmem.h │ │ └── wiidrc.h │ │ ├── link.ld │ │ └── source │ │ ├── PADReadGC.c │ │ └── _crt0.S │ ├── ssl.c │ ├── titles.c │ ├── unzip │ ├── crypt.h │ ├── ioapi.h │ ├── ioapi_mem.c │ ├── miniunz.c │ ├── miniunz.h │ ├── unzip.c │ └── unzip.h │ ├── update.c │ ├── usb.c │ ├── usbstorage.c │ └── wdvd.c ├── mem_map.txt ├── multidol ├── COPYING ├── Makefile ├── README ├── apploader.c ├── apploader.h ├── cache.c ├── cache.h ├── crt0.S ├── dip.c ├── dip.h ├── global.c ├── global.h ├── hw.h ├── main.c ├── openstub.ld ├── types.h ├── utils.c └── utils.h ├── nintendont ├── gcn_md5.zip ├── icon.png ├── meta.xml └── titles.txt ├── patched_demos.txt ├── resetstub ├── COPYING ├── Makefile ├── README ├── cache.c ├── cache.h ├── crt0.S ├── exi.h ├── hw.h ├── ios.c ├── ios.h ├── main.c ├── memory.S ├── memory.h ├── openstub.ld ├── types.h ├── usbgecko.c ├── usbgecko.h ├── utils.c └── utils.h └── scripts └── GameTDB-md5-parser.pl /.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | *.o 3 | *.bin 4 | *.elf 5 | codehandler/*.h 6 | kernel/asm/*.h 7 | kernel/kernel.map 8 | loader/build/ 9 | loader/data/kernel.zip 10 | nintendont/boot.dol 11 | fatfs/*.a 12 | codehandler/*.h -------------------------------------------------------------------------------- /Build.bat: -------------------------------------------------------------------------------- 1 | @REM This batch file is still here for compatibility reasons. 2 | make forced windows=1 3 | pause 4 | -------------------------------------------------------------------------------- /Build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This shell script is still here for compatibility reasons. 3 | make forced 4 | -------------------------------------------------------------------------------- /codehandler/Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | ifeq ($(strip $(DEVKITPPC)),) 4 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") 5 | endif 6 | include $(DEVKITPPC)/wii_rules 7 | #--------------------------------------------------------------------------------- 8 | TARGET := codehandler.h codehandleronly.h 9 | #--------------------------------------------------------------------------------- 10 | ifeq ($(OS),Windows_NT) 11 | BIN2H = ../kernel/bin2h/bin2h.exe 12 | else 13 | BIN2H = ../kernel/bin2h/bin2h 14 | endif 15 | STRIP = $(DEVKITPPC)/bin/powerpc-eabi-strip 16 | #--------------------------------------------------------------------------------- 17 | CFLAGS := -nostartfiles -nodefaultlibs -Wl,-Ttext,0x80001000 18 | STRIPFLAGS := --strip-debug --strip-all --discard-all -F elf32-powerpc 19 | OCFLAGS := -I elf32-powerpc -O binary 20 | #--------------------------------------------------------------------------------- 21 | .PHONY: all clean 22 | 23 | all: $(TARGET) 24 | 25 | %.bin : %.s 26 | @echo " COMPILE $<" 27 | @$(CC) $(CFLAGS) -o $@ $< 28 | @echo " STRIP $<" 29 | @$(STRIP) $(STRIPFLAGS) $@ 30 | @echo " OBJCOPY $<" 31 | @$(OBJCOPY) $(OCFLAGS) $@ 32 | %.h : %.bin 33 | @echo " BIN2H $<" 34 | @$(BIN2H) $< 35 | clean: 36 | -$(RM) $(TARGET) $(TARGET:.h=.bin) 37 | -------------------------------------------------------------------------------- /common/include/CommonConfigStrings.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __COMMON_CONFIG_STRINGS_H__ 3 | #define __COMMON_CONFIG_STRINGS_H__ 4 | 5 | //Strings must match order in CommonConfig.h 6 | const char* OptionStrings[] = 7 | { 8 | "Cheats", 9 | "Debugger", 10 | "Debugger Wait", 11 | "Memcard Emulation", 12 | "Cheat Path", 13 | "Force Widescreen", 14 | "Force Progressive", 15 | "Auto Boot", 16 | "Unlock Read Speed", 17 | "OSReport", 18 | "WiiU Widescreen", //Replaces USB 19 | "Drive Access LED", 20 | "Log", 21 | 22 | "MaxPads", 23 | "Language", 24 | "Video", 25 | "Videomode", 26 | "Memcard Blocks", 27 | "Memcard Multi", 28 | "Native Control", 29 | }; 30 | 31 | const char* LanguageStrings[] = 32 | { 33 | "Eng", 34 | "Ger", 35 | "Fre", 36 | "Spa", 37 | "Ita", 38 | "Dut", 39 | 40 | "Auto", 41 | }; 42 | 43 | const char* VideoStrings[] = 44 | { 45 | "Auto", 46 | "Force", 47 | "None", 48 | "Invalid", 49 | "Force (Deflicker)", 50 | }; 51 | 52 | const char* VideoModeStrings[] = 53 | { 54 | "PAL50", 55 | "PAL60", 56 | "NTSC", 57 | "MPAL", 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /common/include/Metadata.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __META_DATA_H__ 3 | #define __META_DATA_H__ 4 | 5 | #define META_NAME "Nintendont" 6 | #define META_AUTHOR "FIX94, crediar" 7 | 8 | #define META_LONG1 "Commiters: GerbilSoft, JoostinOnline, GreyRogue, Howard, Cyan \r\n\r\n Project website: https://github.com/FIX94/Nintendont " 9 | #define META_LONG2 "Nintendont allows you to run GameCube games on a Wii or Wii U from an SD or HDD device." 10 | #define META_SHORT "Gamecube Loader" 11 | 12 | #define META_XML "" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /common/include/NintendontVersion.h: -------------------------------------------------------------------------------- 1 | #ifndef __NINTENDONT_VERSION_H__ 2 | #define __NINTENDONT_VERSION_H__ 3 | 4 | #define NIN_MAJOR_VERSION 6 5 | #define NIN_MINOR_VERSION 503 6 | 7 | #define NIN_VERSION ((NIN_MAJOR_VERSION << 16) | NIN_MINOR_VERSION) 8 | 9 | #define STRINGIZE2(s) #s 10 | #define STRINGIZE(s) STRINGIZE2(s) 11 | #define NIN_VERSION_STRING "$$Version:" STRINGIZE(NIN_MAJOR_VERSION) "." STRINGIZE(NIN_MINOR_VERSION) 12 | 13 | // "Special" version. 14 | // This should only be set in custom builds, i.e. not mainline. 15 | //#define NIN_SPECIAL_VERSION "-BBABeta13" 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /controllerconfigs/HID_Test.dol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/controllerconfigs/HID_Test.dol -------------------------------------------------------------------------------- /controllerconfigs/Saitek_P990_Dual_Analog_pad.ini: -------------------------------------------------------------------------------- 1 | [Saitek P990 Dual Analog pad] 2 | VID=06A3 3 | PID=040B 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=0 7 | Power=7,20 8 | A=6,4 9 | B=6,2 10 | X=7,1 11 | Y=7,2 12 | Z=6,20 13 | L=6,40 14 | R=6,80 15 | S=7,10 16 | Left=5,7 17 | Down=5,5 18 | Right=5,3 19 | Up=5,1 20 | StickX=0 21 | StickY=1 22 | CStickX=2 23 | CStickY=3 24 | RAnalog=7,8 25 | LAnalog=7,4 26 | 27 | -------------------------------------------------------------------------------- /controllerconfigs/controller_8Bitdo_NES30_Pro.ini: -------------------------------------------------------------------------------- 1 | [8Bitdo NES30 Pro] 2 | VID=2002 3 | PID=9000 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=0 7 | A=0,01 8 | B=0,02 9 | X=0,08 10 | Y=0,10 11 | CStickY=6 12 | CStickX=5 13 | StickY=4 14 | StickX=3 15 | S=1,08 16 | Up=2,00 17 | Right=2,02 18 | Left=2,06 19 | Down=2,04 20 | L=1,01 21 | R=1,02 22 | Z=0,80 23 | Power=1,10 24 | MultiIn=0 25 | RightUp=2,01 26 | DownRight=2,03 27 | DownLeft=2,05 28 | UpLeft=2,07 29 | LAnalog=10,01 30 | RAnalog=10,02 -------------------------------------------------------------------------------- /controllerconfigs/controller_8Bitdo_SNES30_Pro.ini: -------------------------------------------------------------------------------- 1 | [8Bitdo SNES30 Pro MAC Mode] 2 | VID=054C 3 | PID=05C4 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=0 7 | A=5,40 8 | B=5,20 9 | X=5,80 10 | Y=5,10 11 | CStickY=4 12 | CStickX=3 13 | StickY=2 14 | StickX=1 15 | S=6,20 16 | Up=5,00 17 | Right=5,02 18 | Left=5,06 19 | Down=5,04 20 | L=6,04 21 | R=6,08 22 | Z=6,02 23 | Power=6,10 24 | MultiIn=0 25 | RightUp=5,01 26 | DownRight=5,03 27 | DownLeft=5,05 28 | UpLeft=5,07 29 | LAnalog=8 30 | RAnalog=9 31 | -------------------------------------------------------------------------------- /controllerconfigs/controller_CronusMax_Xbox360_Adapter.ini: -------------------------------------------------------------------------------- 1 | [CronusMax Xbox360 Adapter] 2 | VID=054C 3 | PID=05C5 4 | Polltype=1 5 | DPAD=1 6 | Power=7,01 7 | A=5,20 8 | B=5,40 9 | X=5,10 10 | Y=5,80 11 | Z=6,80 12 | L=6,01 13 | R=6,02 14 | S=6,20 15 | Left=5,06 16 | Down=5,04 17 | Right=5,02 18 | Up=5,00 19 | RightUp=5,01 20 | DownRight=5,03 21 | DownLeft=5,05 22 | UpLeft=5,07 23 | StickX=1 24 | StickY=2 25 | CStickX=3 26 | CStickY=4 27 | LAnalog=8 28 | RAnalog=9 29 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Generic_GC Controller Adapter.ini: -------------------------------------------------------------------------------- 1 | ; Configuration file made for 'Generic GC Controller Adapter' device. 2 | ; The label behind this contained the following information - 3 | ; 'GC Controller Adapter For Switch/Wii U/PC ITEM TO HS-SW305' 4 | ; Device must be set in 'PC' mode. 5 | ; Made by cesarmades. 6 | 7 | [Generic GC Controller Adapter] 8 | VID=0079 9 | PID=1846 10 | 11 | Polltype=1 12 | 13 | ; Multiple input (several ports). Don't know if it's the same settings for 2 ports than 4 ports. 14 | MultiIn=1 15 | MultiInValue=01 16 | 17 | A=1,02 18 | B=1,04 19 | X=1,01 20 | Y=1,08 21 | 22 | Z=1,80 23 | 24 | ; Notes from what was seen in other files: 25 | ; 1 = Typical Digital input | 2 = Mix of both? 26 | DigitalLR=2 27 | L=1,10 28 | R=1,20 29 | LAnalog=7 30 | RAnalog=8 31 | 32 | ; Power= 33 | S=2,02 34 | 35 | ; Similar to the HID2VPAD functions: 36 | ; 0 = NORMAL | 1 = HAT | etc 37 | DPAD=0 38 | Left=2,80 39 | Right=2,20 40 | Up=2,10 41 | Down=2,40 42 | 43 | StickX=3 44 | StickY=4 45 | CStickX=6 46 | CStickY=5 47 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Generic_USB_Gamepad_PID=0810_VID=e501.ini: -------------------------------------------------------------------------------- 1 | [Generic USB Gamepad] 2 | VID=0810 3 | PID=e501 4 | 5 | # Polltype: Use 1 (so far only the ps3 controller needed 0) 6 | Polltype=1 7 | DigitalLR=1 8 | 9 | # [Button]=[offset],[mask] 10 | X=5,10 11 | A=5,20 12 | B=5,40 13 | Y=5,80 14 | 15 | # L, R, Z left, Z right 16 | L=6,01 17 | R=6,02 18 | ZL=6,04 19 | Z=6,08 20 | 21 | # Select, Start 22 | Power=6,10 23 | S=6,20 24 | 25 | # Certain Pads use BITs for each dpad direction other use numbers going form 0 to 7 for each direction. 26 | # An easy test for this is if one direction doesn't change any bits then use 1 and fill in all 8 values 27 | # for the DPAD otherwise use 0 and just fill in the four values. 28 | # (the stick value for center is 7F and the extreme values can be mapped to dpad instead if desired) 29 | #DPAD=1 30 | #Right=3,FF 31 | #Left=3,00 32 | #Down=4,FF 33 | #Up=4,00 34 | 35 | # Composite directions have 2 values modified simultaneously so can't be configured 36 | # Center position is xx xx xx 7F 7F xx xx xx xx 37 | # 3,FF FF 38 | #DownRight= 39 | # 3,00 FF 40 | #DownLeft= 41 | # 3,00 00 42 | #UpLeft= 43 | # 3,FF 00 44 | #RightUp= 45 | 46 | StickX=3,0,100 47 | StickY=4,0,100 48 | 49 | # When the stick is missing the value is fixed at 80 50 | CStickX=1 51 | CStickY=2 52 | 53 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Genius_MaxFire G-12UV.ini: -------------------------------------------------------------------------------- 1 | [Genius MaxFire G-12U VIBRATION] 2 | VID=0583 3 | PID=A009 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | 8 | ; 1 9 | A=5,01 10 | ; 3 11 | B=5,04 12 | ; 2 13 | X=5,02 14 | ; 4 15 | Y=5,08 16 | ; 6 17 | Z=5,20 18 | ; 7 19 | L=5,40 20 | ; 8 21 | R=5,80 22 | ; 10 23 | S=6,02 24 | 25 | Left=4,06 26 | Down=4,04 27 | Right=4,02 28 | Up=4,00 29 | RightUp=4,01 30 | DownRight=4,03 31 | DownLeft=4,05 32 | UpLeft=4,07 33 | 34 | StickX=0 35 | StickY=1 36 | 37 | CStickX=2 38 | CStickY=3 39 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Genreic_USB_Gamepad_PID=0079_VID=0006.ini: -------------------------------------------------------------------------------- 1 | [Generic USB Gamepad] 2 | 3 | #ANALOG MODE must be enabled for on the controller for it to work. 4 | # 5 | # This controller.ini was made for a cheap GTC Ribbon controller but it was confirmed that it also works 6 | # with a SF-1801V PC controller and a Acteck 3600; so it should be safe to assume that there are more controllers that might 7 | # work with this .ini, try it if you have a cheap USB gamepad that looks like these. 8 | ####### 9 | # GTC Ribbon (http://arg.gtcribbon.com/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/g/a/gamepad-pc-dual-shock_JPG-165U_large.png) 10 | # SF - 1801V(http://www.callegranvia.com/images/product/53/be94de6c45b1fe8d216d00ae530499d7.jpg) 11 | ####### 12 | 13 | VID=0079 14 | PID=0006 15 | Polltype=1 16 | DPAD=1 17 | DigitalLR=1 18 | A=5,40 19 | B=5,80 20 | X=5,20 21 | Y=5,10 22 | Z=6,08 23 | L=6,01 24 | R=6,02 25 | S=6,20 26 | Power=6,10 27 | Left=5,06 28 | Down=5,04 29 | Right=5,02 30 | Up=5,00 31 | RightUp=5,01 32 | DownRight=5,03 33 | DownLeft=5,05 34 | UpLeft=5,07 35 | StickX=0 36 | StickY=1 37 | CStickX=3 38 | CStickY=4 39 | RAnalog=0 40 | LAnalog=0 41 | Rumble=1 42 | RumbleType=1 43 | RumbleDataLen=0E 44 | RumbleDataOn=51,00,00,00,FF,00,00,FA,FE,00,00,00,00,00 45 | RumbleDataOff=51,00,00,00,00,00,00,FA,FE,00,00,00,00,00 46 | RumbleTransferLen=07 47 | RumbleTransfers=2 48 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Gioteck_SC-1.ini: -------------------------------------------------------------------------------- 1 | [Gioteck SC-1] 2 | VID=25f0 3 | PID=83c1 4 | Polltype=1 5 | DPAD=1 6 | Power=1,10 7 | A=0,02 8 | B=0,04 9 | X=0,08 10 | Y=0,01 11 | Z=0,20 12 | L=0,40 13 | R=0,80 14 | S=1,02 15 | Left=2,06 16 | Down=2,04 17 | Right=2,02 18 | Up=2,00 19 | RightUp=2,01 20 | DownRight=2,03 21 | DownLeft=2,05 22 | UpLeft=2,07 23 | StickX=3 24 | StickY=4 25 | CStickX=5 26 | CStickY=6 27 | LAnalog=11 28 | RAnalog=12 29 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Gravis_Eliminator_AfterShock.ini: -------------------------------------------------------------------------------- 1 | [Gravis Eliminator AfterShock] 2 | VID=047D 3 | PID=4006 4 | Polltype=1 5 | DPAD=1 6 | B=6,02 7 | A=6,04 8 | Y=6,01 9 | X=6,08 10 | L=6,10 11 | ZL=6,40 12 | Z=6,80 13 | R=6,20 14 | S=7,02 15 | Power=7,03 16 | Left=4,00 17 | Down=5,FF 18 | Right=4,FF 19 | Up=5,00 20 | StickX=0 21 | StickY=1 22 | CStickX=3 23 | CStickY=2 24 | DigitalLR=1 25 | LAnalog=0 26 | RAnalog=0 27 | Rumble=1 28 | RumbleType=0 29 | RumbleDataLen=05 30 | RumbleDataOn=01,00,00,7F,7F 31 | RumbleDataOff=01,00,00,00,00 32 | RumbleTransferLen=05 33 | RumbleTransfers=1 34 | 35 | #Gravis Eliminator AfterShock for Nintendon't 36 | #--------------------------------------------- 37 | #Controller Type: Arcade-style/dual-analog gamepad (like DualShock 2) 38 | #Rumble Support: Force Feedback 39 | #Special Features: Analog sticks, D-pad, precision control toggles 40 | #Note: This controller is probably common for Windows 95-98 & up. 41 | 42 | #Button Setup: 43 | # D-Pad: GameCube D-Pad 44 | # Left Control Stick: Control Stick 45 | # Right Control Stick: C Stick 46 | # Button 1: Y 47 | # Button 2: B 48 | # Button 3: A 49 | # Button 4: X 50 | # Button 5: L 51 | # Button 6: R 52 | # Button 7: Half shoulder button force 53 | # Button 8: Z 54 | # Button 9: unused 55 | # Button 10: Start/Pause 56 | # Button 9 & Button 10: Power 57 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Gravis_Eliminator_GamePad_Pro.ini: -------------------------------------------------------------------------------- 1 | [Gravis Eliminator GamePad Pro] 2 | VID=047D 3 | PID=4005 4 | Polltype=1 5 | DPAD=0 6 | Power=3,03 7 | A=2,04 8 | B=2,02 9 | X=2,08 10 | Y=2,01 11 | Z=2,20 12 | L=2,40 13 | R=2,80 14 | S=3,02 15 | #Left=2,26 16 | #Down=2,24 17 | #Right=2,22 18 | #Up=2,20 19 | #RightUp=2,21 20 | #DownRight=2,23 21 | #DownLeft=2,25 22 | #UpLeft=2,27 23 | StickX=0 24 | StickY=1 25 | #CStickX=5 26 | #CStickY=6 27 | DigitalLR=1 28 | LAnalog=0 29 | RAnalog=0 30 | 31 | #Gravis Eliminator GamePad Pro for Nintendon't 32 | #--------------------------------------------- 33 | #Controller Type: Arcade/Retro gamepad 34 | #Rumble Support: None 35 | #Special Features: Analog D-pad, precision control toggle 36 | 37 | #Button Setup: 38 | # D-Pad: Control Stick 39 | # Button 1: Y 40 | # Button 2: B 41 | # Button 3: A 42 | # Button 4: X 43 | # Button 5: unused (Full shoulder button force) 44 | # Button 6: Z 45 | # Button 7: L 46 | # Button 8: R 47 | # Button 9: unused 48 | # Button 10: Start/Pause 49 | # Button 9 & Button 10: Power 50 | 51 | #Recommended Games: 52 | # * Ikaruga 53 | # * Chaos Field Expanded 54 | # * Mobile Light Force 2 / Castle of Shikigami 55 | # * Capcom vs. SNK EO 56 | # * Rave Master 57 | # * Super Smash Bros. Melee 58 | # * Sonic Gems Collection 59 | # * Sonic Mega Collection 60 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Hori_Real_Arcade_Pro_3_SA.ini: -------------------------------------------------------------------------------- 1 | [Hori Real Arcade Pro 3 SA] 2 | VID=0F0D 3 | PID=0011 4 | Polltype=0 5 | DPAD=0 6 | DigitalLR=1 7 | Power=1,10 8 | A=0,4 9 | B=0,2 10 | X=0,8 11 | Y=0,1 12 | Z=12,FF 13 | L=0,10 14 | R=0,20 15 | S=1,2 16 | Left=8,FF 17 | Down=0A,FF 18 | Right=7,FF 19 | Up=9,FF 20 | StickX=3 21 | StickY=4 22 | CStickX=5 23 | CStickY=6 24 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Logitech_Cordless_Rumblepad_2.ini: -------------------------------------------------------------------------------- 1 | [Logitech Cordless Rumblepad 2] 2 | VID=046D 3 | PID=C219 4 | Polltype=1 5 | DPAD=1 6 | B=5,10 7 | A=5,20 8 | Y=5,40 9 | X=5,80 10 | L=6,04 11 | Z=6,02 12 | R=6,08 13 | S=6,20 14 | Power=6,40 15 | Left=5,06 16 | Down=5,04 17 | Right=5,02 18 | Up=5,00 19 | RightUp=5,01 20 | DownRight=5,03 21 | DownLeft=5,05 22 | UpLeft=5,07 23 | StickX=1 24 | StickY=2 25 | CStickX=3 26 | CStickY=4 27 | LAnalog=0 28 | RAnalog=0 29 | DigitalLR=1 30 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Logitech_F310.ini: -------------------------------------------------------------------------------- 1 | [Logitech F310] 2 | VID=046D 3 | PID=C216 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 # This pad only supports digital triggers, doesn't work with games like Luigi's mansion otherwise 7 | A=4,20 8 | B=4,40 9 | X=4,10 10 | Y=4,80 11 | Z=5,02 12 | L=5,04 13 | R=5,08 14 | ZL=5,01 # Adds the ZL switch in the L1 position to allow half-presses 15 | S=5,20 16 | Power=5,10 17 | Left=4,06 18 | Down=4,04 19 | Right=4,02 20 | Up=4,00 21 | RightUp=4,01 22 | DownRight=4,03 23 | DownLeft=4,05 24 | UpLeft=4,07 25 | StickX=0 26 | StickY=1 27 | CStickX=2 28 | CStickY=3 29 | LAnalog=0F 30 | RAnalog=0E 31 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Logitech_RumblePad_2_and_Rumble_Gamepad_F510.ini: -------------------------------------------------------------------------------- 1 | [Logitech RumblePad 2 and Rumble Gamepad F510] 2 | VID=046D 3 | PID=C218 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | A=4,20 8 | B=4,10 9 | X=4,40 10 | Y=4,80 11 | ZL=5,01 12 | Z=5,02 13 | L=5,04 14 | R=5,08 15 | Power=5,10 16 | S=5,20 17 | Left=4,06 18 | Down=4,04 19 | Right=4,02 20 | Up=4,00 21 | RightUp=4,01 22 | DownRight=4,03 23 | DownLeft=4,05 24 | UpLeft=4,07 25 | StickX=0 26 | StickY=1 27 | CStickX=2 28 | CStickY=3 29 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Mayflash_3_in_1_Magic_Joy_Box.ini: -------------------------------------------------------------------------------- 1 | [Mayflash 3 in 1 Magic Joy Box] 2 | VID=0926 3 | PID=2526 4 | Polltype=1 5 | DPAD=1 6 | A=1,01 7 | B=1,02 8 | X=1,04 9 | Y=1,08 10 | Z=1,40 11 | L=1,10 12 | R=1,20 13 | S=1,80 14 | Left=2,01 15 | Down=2,04 16 | Right=2,02 17 | Up=2,08 18 | RightUp=2,0A 19 | DownRight=2,06 20 | DownLeft= 2,05 21 | UpLeft=2,09 22 | StickX=3,0,100 23 | StickY=4,0,100 24 | CStickX=5,0,100 25 | CStickY=6,0,100 26 | LAnalog=7 27 | RAnalog=7 28 | Power=1,62 29 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Mayflash_wiiccprousb-PC045.ini: -------------------------------------------------------------------------------- 1 | [Mayflash CCPro USB Adapter - PC045] 2 | VID=0925 3 | PID=03E8 4 | Polltype=1 5 | MultiIn=1 6 | MultiInValue=01 7 | DPAD=1 8 | DigitalLR=2 9 | Power=2,03 10 | A=1,02 11 | B=1,08 12 | X=1,01 13 | Y=1,04 14 | Z=1,80 15 | L=6,78 16 | R=7,0F 17 | S=2,02 18 | Left=4,60 19 | Down=4,40 20 | Right=4,20 21 | Up=4,00 22 | RightUp=4,10 23 | DownRight=4,30 24 | DownLeft=4,50 25 | UpLeft=4,70 26 | StickX=3,0,100 27 | StickY=4,0,100 28 | CStickX=5,0,100 29 | CStickY=6,0,100 30 | LAnalog=6 31 | RAnalog=7 32 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Mayflash_wiiccusb-PC052.ini: -------------------------------------------------------------------------------- 1 | [MayFlash Wii CC USB Adapter - PC052] 2 | VID=1D79 3 | PID=0301 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | Power=6,40 8 | A=5,20 9 | B=5,40 10 | X=5,10 11 | Y=5,80 12 | Z=6,02 13 | L=6,04 14 | R=6,08 15 | S=6,20 16 | Left=5,06 17 | Down=5,04 18 | Right=5,02 19 | Up=5,00 20 | RightUp=5,01 21 | DownRight=5,03 22 | DownLeft=5,05 23 | UpLeft=5,07 24 | StickX=2 25 | StickY=3 26 | CStickX=0 27 | CStickY=1 28 | LAnalog=20 29 | RAnalog=21 30 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Microsoft_Sidewinder_Forcefeedback_2_Joystick.ini: -------------------------------------------------------------------------------- 1 | [Microsoft Sidewinder Force Feedback 2 Joystick] 2 | VID=045E 3 | PID=001B 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | A=8,01 8 | B=8,02 9 | X=8,08 10 | Y=8,04 11 | Z=8,20 12 | L=8,80 13 | R=8,10 14 | Power=8,F0 15 | S=8,40 16 | Left=7,06 17 | Down=7,04 18 | Right=7,02 19 | Up=7,00 20 | RightUp=7,01 21 | DownRight=7,03 22 | DownLeft=7,05 23 | UpLeft=7,07 24 | StickX=1 25 | StickY=3 26 | CStickX=5 27 | CStickY=6 28 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Microsoft_Sidewinder_Precision_2_Joystick.ini: -------------------------------------------------------------------------------- 1 | [Microsoft Sidewinder Precision 2 Joystick] 2 | VID=045E 3 | PID=0038 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | A=4,01 8 | B=4,02 9 | X=4,08 10 | Y=4,04 11 | Z=4,20 12 | L=4,80 13 | R=4,10 14 | Power=4,F0 15 | S=4,40 16 | Left=5,60 17 | Down=5,40 18 | Right=5,20 19 | Up=5,00 20 | RightUp=5,10 21 | DownRight=5,30 22 | DownLeft=5,50 23 | UpLeft=5,70 24 | StickX=0 25 | StickY=1 26 | CStickX=2 27 | CStickY=3 28 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Nintendo_Wii_U_GameCube_Adapter.ini: -------------------------------------------------------------------------------- 1 | [Nintendo Wii U GameCube Controller Adapter] 2 | VID=057E 3 | PID=0337 4 | Polltype=1 5 | DPAD=1 6 | MultiIn=3 7 | MultiInValue=09 8 | Power=3,0F 9 | A=2,01 10 | B=2,02 11 | X=2,04 12 | Y=2,08 13 | Z=3,02 14 | L=3,08 15 | R=3,04 16 | S=3,01 17 | Left=2,10 18 | Down=2,40 19 | Right=2,20 20 | Up=2,80 21 | RightUp=2,A0 22 | DownRight=2,60 23 | DownLeft=2,50 24 | UpLeft=2,90 25 | StickX=4,0,100 26 | StickY=5,0,100 27 | CStickX=6,0,100 28 | CStickY=7,0,100 29 | LAnalog=8 30 | RAnalog=9 31 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Nvidia_Shield.ini: -------------------------------------------------------------------------------- 1 | [Nvidia Shield] 2 | VID=0955 3 | PID=7210 4 | Polltype=1 5 | MultiIn=1 6 | MultiInValue=01 7 | DPAD=1 8 | DigitalLR=2 9 | Power=2,80 10 | A=1,01 11 | B=1,04 12 | X=1,02 13 | Y=1,08 14 | Z=1,20 15 | L=0D,FF 16 | R=0F,FF 17 | S=2,02 18 | Left=3,06 19 | Down=3,04 20 | Right=3,02 21 | Up=3,00 22 | RightUp=3,01 23 | DownRight=3,03 24 | DownLeft=3,05 25 | UpLeft=3,07 26 | StickX=5 27 | StickY=7 28 | CStickX=9 29 | CStickY=0B 30 | LAnalog=0D 31 | RAnalog=0F 32 | -------------------------------------------------------------------------------- /controllerconfigs/controller_PDP_Afterglow_AP_1_Controller_for_PS3.ini: -------------------------------------------------------------------------------- 1 | [PDP Afterglow AP.1 Controller for PS3] 2 | VID=1A34 3 | PID=0836 4 | Polltype=1 5 | DPAD=1 6 | B=5,01 7 | A=5,02 8 | Y=5,08 9 | X=5,04 10 | L=5,40 11 | Z=5,20 12 | R=5,80 13 | S=6,02 14 | Power=6,09 15 | Left=7,06 16 | Down=7,04 17 | Right=7,02 18 | Up=7,00 19 | RightUp=7,01 20 | DownRight=7,03 21 | DownLeft=7,05 22 | UpLeft=7,07 23 | StickX=0 24 | StickY=1 25 | CStickX=2 26 | CStickY=3 27 | LAnalog=0 28 | RAnalog=0 29 | DigitalLR=1 30 | -------------------------------------------------------------------------------- /controllerconfigs/controller_PowerA_Wired_PS3.ini: -------------------------------------------------------------------------------- 1 | [POWER A WIRED PS3 Controller] 2 | # Model Num: 1429765-01 3 | 4 | VID=20D6 5 | PID=CA6D 6 | 7 | Polltype=1 8 | DPAD=1 9 | 10 | # Enable Analog triggers 11 | DigitalLR=2 12 | 13 | MultiIn=0 14 | MultiInValue=01 15 | 16 | # PS3 "Home" Button 17 | Power=1,10 18 | 19 | A=0,02 20 | B=0,01 21 | X=0,04 22 | Y=0,08 23 | Z=0,20 24 | L=11,F0 25 | R=12,F0 26 | 27 | # Start 28 | S=1,02 29 | 30 | # DPad 31 | Left=2,06 32 | Down=2,04 33 | Right=2,02 34 | Up=2,00 35 | RightUp=2,01 36 | DownRight=2,03 37 | DownLeft=2,05 38 | UpLeft=2,07 39 | 40 | # Left Analog Stick 41 | StickX=3 42 | StickY=4 43 | 44 | # Right Analog Stick 45 | CStickX=5 46 | CStickY=6 47 | 48 | LAnalog=11 49 | RAnalog=12 -------------------------------------------------------------------------------- /controllerconfigs/controller_Qanba_Drone_N2.ini: -------------------------------------------------------------------------------- 1 | [Controller (QANBA DRONE ARCADE JOYSTICK / PS4 mode)] 2 | VID=2c22 3 | PID=2000 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=0 7 | A=05,80 8 | B=05,10 9 | X=06,02 10 | Y=05,20 11 | Z=06,01 12 | L=05,40 13 | R=06,08 14 | S=06,20 15 | Up=05,00 16 | Right=05,02 17 | Left=05,06 18 | Down=05,04 19 | UpLeft=05,07 20 | DownLeft=05,05 21 | DownRight=05,03 22 | RightUp=05,01 23 | Power=06,10 24 | StickX=1 25 | StickY=2 26 | CStickX=3 27 | CStickY=4 28 | MultiIn=0 29 | LAnalog=0 30 | RAnalog=0 31 | 32 | #QANBA DRONE ARCADE JOYSTICK for Nintendon't 33 | #--------------------------------------------- 34 | #Controller Type: Arcade-style 35 | #Rumble Support: No 36 | #Special Features: Turbo button, Switch button for Analog/D-Pad 37 | 38 | 39 | #Button Setup: 40 | # Joystick: GameCube D-Pad 41 | # Green LED Mode button: Control Stick 42 | # Red LED Mode button: C Stick 43 | # Button Square: B 44 | # Button Triangle: A 45 | # Button R1: X 46 | # Button X: Y 47 | # Button O: L 48 | # Button R2: R 49 | # Button L1: Z 50 | # Button Option: Start/Pause 51 | # Button Share: Power off -------------------------------------------------------------------------------- /controllerconfigs/controller_Thrustmaster_Dual_Analog_4.ini: -------------------------------------------------------------------------------- 1 | [Thrustmaster Dual Analog 4] 2 | VID=044F 3 | PID=B315 4 | Polltype=1 5 | DigitalLR=1 6 | DPAD=1 7 | A=0,04 8 | B=0,01 9 | X=0,08 10 | Y=0,02 11 | ZL=0,10 12 | Z=0,40 13 | L=0,20 14 | R=0,80 15 | S=1,02 16 | Left=2,60 17 | Down=2,40 18 | Right=2,20 19 | Up=2,00 20 | RightUp=2,10 21 | DownRight=2,30 22 | DownLeft=2,50 23 | UpLeft=2,70 24 | StickX=3 25 | StickY=4 26 | CStickX=5 27 | CStickY=6 28 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Thrustmaster_Firestorm_Dual_Analog_2.ini: -------------------------------------------------------------------------------- 1 | [Logitech Thrustmaster Firestorm Dual Analog 2] 2 | VID=044F 3 | PID=B303 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | A=0,01 8 | B=0,02 9 | X=0,04 10 | Y=0,08 11 | ZL=0,10 12 | Z=0,40 13 | L=0,20 14 | R=0,80 15 | Power=1,03 16 | S=1,02 17 | Left=2,60 18 | Down=2,40 19 | Right=2,20 20 | Up=2,00 21 | RightUp=2,10 22 | DownRight=2,30 23 | DownLeft=2,50 24 | UpLeft=2,70 25 | StickX=3 26 | StickY=4 27 | CStickX=5 28 | CStickY=6 29 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Thrustmaster_T-Wireless.ini: -------------------------------------------------------------------------------- 1 | [Thrustmaster T-Wireless] 2 | VID=044F 3 | PID=D007 4 | Polltype=1 5 | DPAD=1 6 | Power=1,10 7 | A=0,02 8 | B=0,01 9 | X=0,04 10 | Y=0,08 11 | Z=0,20 12 | L=0,40 13 | R=0,80 14 | S=1,02 15 | Left=2,26 16 | Down=2,24 17 | Right=2,22 18 | Up=2,20 19 | RightUp=2,21 20 | DownRight=2,23 21 | DownLeft=2,25 22 | UpLeft=2,27 23 | StickX=3 24 | StickY=4 25 | CStickX=5 26 | CStickY=6 27 | DigitalLR=1 28 | LAnalog=0 29 | RAnalog=0 30 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Trio_Linker_Plus_II.ini: -------------------------------------------------------------------------------- 1 | [Trio Linker Plus II] 2 | VID=2006 3 | PID=0118 4 | Polltype=1 5 | DPAD=1 6 | A=1,01 7 | B=1,02 8 | X=1,04 9 | Y=1,08 10 | Z=1,40 11 | L=1,10 12 | R=1,20 13 | S=2,01 14 | Left=2,60 15 | Down=2,40 16 | Right=2,20 17 | Up=2,00 18 | RightUp=2,10 19 | DownRight=2,30 20 | DownLeft=2,50 21 | UpLeft=2,70 22 | StickX=3 23 | StickY=4 24 | CStickX=5 25 | CStickY=6 26 | LAnalog=7 27 | RAnalog=7 28 | -------------------------------------------------------------------------------- /controllerconfigs/controller_Trust_Predator_Gamepad.ini: -------------------------------------------------------------------------------- 1 | [Trust Predator Gamepad] 2 | VID=0810 3 | PID=0003 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | A=5,40 8 | B=5,80 9 | X=5,20 10 | Y=5,10 11 | Z=6,08 12 | L=6,01 13 | R=6,02 14 | S=6,20 15 | Power=6,10 16 | Left=5,06 17 | Down=5,04 18 | Right=5,02 19 | Up=5,00 20 | RightUp=5,01 21 | DownRight=5,03 22 | DownLeft=5,05 23 | UpLeft=5,07 24 | StickX=3 25 | StickY=4 26 | CStickX=2 27 | CStickY=1 28 | -------------------------------------------------------------------------------- /controllerconfigs/controller_UnderControl_Switch.ini: -------------------------------------------------------------------------------- 1 | [UnderControl Switch] 2 | VID=0079 3 | PID=181C 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | A=0,02 8 | B=0,01 9 | X=0,10 10 | Y=0,08 11 | CStickY=6 12 | CStickX=5 13 | StickY=4 14 | StickX=3 15 | S=1,08 16 | Up=2,00 17 | Right=2,02 18 | Left=2,06 19 | Down=2,04 20 | L=0,40 21 | R=0,80 22 | ZL=1,01 23 | Z=1,02 24 | Power=1,10 25 | RightUp=2,01 26 | DownRight=2,03 27 | DownLeft=2,05 28 | UpLeft=2,07 29 | -------------------------------------------------------------------------------- /controllerconfigs/controller_brook_ps3_4_fighting_board.ini: -------------------------------------------------------------------------------- 1 | [Brook PS3/PS4 fighting board] 2 | VID=0C12 3 | PID=0EF9 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | MultiIn=0 8 | LAnalog=0 9 | RAnalog=0 10 | Power=1,04 11 | Left=2,06 12 | Down=2,04 13 | Right=2,02 14 | Up=2,00 15 | RightUp=2,01 16 | DownRight=2,03 17 | DownLeft=2,05 18 | UpLeft=2,07 19 | A=0,01 20 | B=0,02 21 | X=0,08 22 | Y=0,04 23 | Z=0,10 24 | L=0,40 25 | R=0,80 26 | S=1,02 27 | StickX=3 28 | StickY=4 29 | CStickX=5 30 | CStickY=6 31 | -------------------------------------------------------------------------------- /controllerconfigs/controller_brook_zero_pi_easy.ini: -------------------------------------------------------------------------------- 1 | [Brook Zero Pi Easy fighting board] 2 | VID=0F0D 3 | PID=00AA 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | MultiIn=0 8 | LAnalog=0 9 | RAnalog=0 10 | Power=1,10 11 | Left=2,06 12 | Down=2,04 13 | Right=2,02 14 | Up=2,00 15 | RightUp=2,01 16 | DownRight=2,03 17 | DownLeft=2,05 18 | UpLeft=2,07 19 | A=0,08 20 | B=0,01 21 | X=0,20 22 | Y=0,02 23 | Z=0,10 24 | L=0,80 25 | R=0,40 26 | S=1,02 27 | StickX=3 28 | StickY=4 29 | CStickX=5 30 | CStickY=6 -------------------------------------------------------------------------------- /controllerconfigs/controller_ini_to_array.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/controllerconfigs/controller_ini_to_array.exe -------------------------------------------------------------------------------- /controllerconfigs/controller_ini_to_array/build.bat: -------------------------------------------------------------------------------- 1 | gcc -Wall -O1 -static -s main.c -o ../controller_ini_to_array 2 | pause -------------------------------------------------------------------------------- /controllerconfigs/controller_ps2.ini: -------------------------------------------------------------------------------- 1 | [PS2 Controller] 2 | VID=0810 3 | PID=0001 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | MultiIn=1 8 | MultiInValue=01 9 | Power=6,10 10 | A=5,20 11 | B=5,40 12 | X=5,10 13 | Y=5,80 14 | Z=6,08 15 | L=6,01 16 | R=6,02 17 | S=6,20 18 | Left=5,06 19 | Down=5,04 20 | Right=5,02 21 | Up=5,00 22 | RightUp=5,01 23 | DownRight=5,03 24 | DownLeft=5,05 25 | UpLeft=5,07 26 | StickX=3,1A,100 27 | StickY=4,1A,100 28 | CStickX=2,1A,100 29 | CStickY=1,1A,100 30 | LAnalog=0 31 | RAnalog=0 32 | Rumble=1 33 | RumbleType=0 34 | RumbleDataLen=05 35 | RumbleDataOn=01,00,00,7F,7F 36 | RumbleDataOff=01,00,00,00,00 37 | RumbleTransferLen=05 38 | RumbleTransfers=1 39 | -------------------------------------------------------------------------------- /controllerconfigs/controller_ps3.ini: -------------------------------------------------------------------------------- 1 | [DualShock 3] 2 | VID=054C 3 | PID=0268 4 | Polltype=0 5 | DPAD=0 6 | DigitalLR=2 7 | Power=2,01 8 | A=3,20 9 | B=3,40 10 | X=3,10 11 | Y=3,80 12 | Z=3,08 13 | L=12,F0 14 | R=13,F0 15 | S=2,08 16 | Left=2,80 17 | Down=2,40 18 | Right=2,20 19 | Up=2,10 20 | StickX=6 21 | StickY=7 22 | CStickX=8 23 | CStickY=9 24 | LAnalog=12 25 | RAnalog=13 -------------------------------------------------------------------------------- /controllerconfigs/controller_ps4.ini: -------------------------------------------------------------------------------- 1 | [DualShock 4v1] 2 | VID=054C 3 | PID=05C4 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=2 7 | Power=6,10 8 | A=5,40 9 | B=5,20 10 | X=5,80 11 | Y=5,10 12 | Z=6,02 13 | L=8,F0 14 | R=9,F0 15 | S=6,20 16 | Left=5,06 17 | Down=5,04 18 | Right=5,02 19 | Up=5,00 20 | RightUp=5,01 21 | DownRight=5,03 22 | DownLeft=5,05 23 | UpLeft=5,07 24 | StickX=1 25 | StickY=2 26 | CStickX=3 27 | CStickY=4 28 | LAnalog=8 29 | RAnalog=9 30 | Rumble=1 31 | RumbleType=1 32 | RumbleDataLen=06 33 | RumbleDataOn=05,01,00,00,FF,FF 34 | RumbleDataOff=05,01,00,00,00,00 35 | RumbleTransferLen=06 36 | RumbleTransfers=1 -------------------------------------------------------------------------------- /controllerconfigs/controller_ps4v2.ini: -------------------------------------------------------------------------------- 1 | [DualShock 4v2] 2 | VID=054C 3 | PID=09CC 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=2 7 | Power=6,10 8 | A=5,40 9 | B=5,20 10 | X=5,80 11 | Y=5,10 12 | Z=6,02 13 | L=8,F0 14 | R=9,F0 15 | S=6,20 16 | Left=5,06 17 | Down=5,04 18 | Right=5,02 19 | Up=5,00 20 | RightUp=5,01 21 | DownRight=5,03 22 | DownLeft=5,05 23 | UpLeft=5,07 24 | StickX=1 25 | StickY=2 26 | CStickX=3 27 | CStickY=4 28 | LAnalog=8 29 | RAnalog=9 30 | Rumble=1 31 | RumbleType=1 32 | RumbleDataLen=06 33 | RumbleDataOn=05,01,00,00,FF,FF 34 | RumbleDataOff=05,01,00,00,00,00 35 | RumbleTransferLen=06 36 | RumbleTransfers=1 -------------------------------------------------------------------------------- /controllerconfigs/controller_ps5.ini: -------------------------------------------------------------------------------- 1 | [DualSense] 2 | VID=054C 3 | PID=0CE6 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=2 7 | Power=9,10 8 | A=8,40 9 | B=8,20 10 | X=8,80 11 | Y=8,10 12 | Z=9,02 13 | L=9,04 14 | R=9,08 15 | S=9,20 16 | Left=8,06 17 | Down=8,04 18 | Right=8,02 19 | Up=8,00 20 | RightUp=8,01 21 | DownRight=8,03 22 | DownLeft=8,05 23 | UpLeft=8,07 24 | StickX=1 25 | StickY=2 26 | CStickX=3 27 | CStickY=4 28 | LAnalog=5 29 | RAnalog=6 -------------------------------------------------------------------------------- /controllerconfigs/controller_ps5_edge.ini: -------------------------------------------------------------------------------- 1 | [DualSense Edge] 2 | VID=054C 3 | PID=0DF2 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=2 7 | Power=9,10 8 | A=8,40 9 | B=8,20 10 | X=8,80 11 | Y=8,10 12 | Z=9,02 13 | L=9,04 14 | R=9,08 15 | S=9,20 16 | Left=8,06 17 | Down=8,04 18 | Right=8,02 19 | Up=8,00 20 | RightUp=8,01 21 | DownRight=8,03 22 | DownLeft=8,05 23 | UpLeft=8,07 24 | StickX=1 25 | StickY=2 26 | CStickX=3 27 | CStickY=4 28 | LAnalog=5 29 | RAnalog=6 30 | -------------------------------------------------------------------------------- /controllerconfigs/controller_switch_gamecube.ini: -------------------------------------------------------------------------------- 1 | [Switch Wired Game Cube] 2 | VID=0E6F 3 | PID=0185 4 | Polltype=1 5 | DPAD=1 6 | DigitalLR=1 7 | A=0,04 8 | B=0,02 9 | X=0,08 10 | Y=0,01 11 | Z=0,20 12 | L=0,40 13 | R=0,80 14 | S=1,02 15 | Left=2,06 16 | Down=2,04 17 | Right=2,02 18 | Up=2,00 19 | RightUp=2,01 20 | DownRight=2,03 21 | DownLeft=2,05 22 | UpLeft=2,07 23 | StickX=3 24 | StickY=4 25 | CStickX=5 26 | CStickY=6 27 | Power=1,20 28 | LAnalog=1,04 29 | RAnalog=1,08 30 | -------------------------------------------------------------------------------- /controllerconfigs/controllers.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/controllerconfigs/controllers.zip -------------------------------------------------------------------------------- /controllerconfigs/nintendont_triolinker1.ini: -------------------------------------------------------------------------------- 1 | [Trio Linker V1] 2 | VID=7701 3 | PID=0003 4 | Polltype=1 5 | DPAD=0 6 | DigitalLR=0 7 | A=0,04 8 | B=0,08 9 | X=0,02 10 | Y=0,01 11 | Z=0,80 12 | L=0,10 13 | R=0,20 14 | S=1,02 15 | Left=1,80 16 | Down=1,40 17 | Right=1,20 18 | Up=1,10 19 | StickX=2 20 | StickY=3 21 | CStickX=4 22 | CStickY=5 23 | LAnalog=0 24 | RAnalog=0 25 | -------------------------------------------------------------------------------- /controllerconfigs/nintendont_wiiuprousb.ini: -------------------------------------------------------------------------------- 1 | [Mayflash WiiU Pro Controller Adapter - W009] 2 | VID=0079 3 | PID=1800 4 | Polltype=1 5 | MultiIn=1 6 | MultiInValue=01 7 | DPAD=1 8 | DigitalLR=1 9 | A=1,04 10 | B=1,01 11 | X=1,08 12 | Y=1,02 13 | Z=1,20 14 | L=1,40 15 | R=1,80 16 | Power=2,04 17 | S=2,08 18 | Left=7,06 19 | Down=7,04 20 | Right=7,02 21 | Up=7,00 22 | RightUp=7,01 23 | DownRight=7,03 24 | DownLeft=7,05 25 | UpLeft=7,07 26 | StickX=3 27 | StickY=4 28 | CStickX=5 29 | CStickY=6 30 | LAnalog=0 31 | RAnalog=0 32 | -------------------------------------------------------------------------------- /fatfs/00readme.txt: -------------------------------------------------------------------------------- 1 | FatFs Module Source Files R0.12a 2 | 3 | 4 | FILES 5 | 6 | 00readme.txt This file. 7 | history.txt Revision history. 8 | ffconf.h Configuration file for FatFs module. 9 | ff.h Common include file for FatFs and application module. 10 | ff.c FatFs module. 11 | diskio.h Common include file for FatFs and disk I/O module. 12 | diskio.c An example of glue function to attach existing disk I/O module to FatFs. 13 | integer.h Integer type definitions for FatFs. 14 | option Optional external functions. 15 | 16 | 17 | Low level disk I/O module is not included in this archive because the FatFs 18 | module is only a generic file system layer and not depend on any specific 19 | storage device. You have to provide a low level disk I/O module that written 20 | to control the target storage device. 21 | 22 | -------------------------------------------------------------------------------- /fatfs/Makefile.arm: -------------------------------------------------------------------------------- 1 | # FatFS Makefile for ARM (Nintendont kernel) 2 | 3 | #--------------------------------------------------------------------------------- 4 | # Clear the implicit built in rules 5 | #--------------------------------------------------------------------------------- 6 | 7 | .SUFFIXES: 8 | #--------------------------------------------------------------------------------- 9 | ifeq ($(strip $(DEVKITARM)),) 10 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 11 | endif 12 | 13 | PREFIX := $(DEVKITARM)/bin/arm-none-eabi- 14 | CC := $(PREFIX)gcc 15 | AS := $(PREFIX)as 16 | LD := $(PREFIX)gcc 17 | AR := $(PREFIX)ar 18 | STRIP := $(PREFIX)strip 19 | 20 | CFLAGS := -mbig-endian -O3 -std=gnu89 -g -I. -Wall \ 21 | -mcpu=arm926ej-s -msoft-float -mfloat-abi=soft \ 22 | -fdata-sections -ffunction-sections -fno-builtin-toupper -fno-builtin-memcpy \ 23 | -fno-builtin-memset -fno-builtin-memcmp -fno-builtin-malloc -fno-builtin-free 24 | 25 | ARFLAGS := cru 26 | 27 | TARGET := libfatfs-arm.a 28 | OBJECTS := ff-arm.o ff_utf8-arm.o option/ccsbcs-arm.o 29 | 30 | .PHONY: FORCE 31 | 32 | all: $(TARGET) 33 | 34 | -include $(OBJECTS:.o=.d) 35 | 36 | $(TARGET): $(OBJECTS) 37 | @echo "AR $@" 38 | @$(AR) $(ARFLAGS) $@ $(OBJECTS) 39 | 40 | %-arm.o : %.c 41 | @echo "CC $@" 42 | @$(CC) $(CFLAGS) -c -MMD -MP -MF $(@:.o=.d) -o $@ $< 43 | 44 | clean: 45 | -$(RM) -f *-arm.a *-arm.o *-arm.d option/*-arm.o option/*-arm.d 46 | -------------------------------------------------------------------------------- /fatfs/Makefile.ppc: -------------------------------------------------------------------------------- 1 | # FatFS Makefile for PowerPC (Nintendont loader) 2 | 3 | #--------------------------------------------------------------------------------- 4 | # Clear the implicit built in rules 5 | #--------------------------------------------------------------------------------- 6 | 7 | .SUFFIXES: 8 | #--------------------------------------------------------------------------------- 9 | ifeq ($(strip $(DEVKITPPC)),) 10 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") 11 | endif 12 | 13 | include $(DEVKITPPC)/wii_rules 14 | 15 | CFLAGS := -O3 -g -std=gnu89 -Wall $(MACHDEP) 16 | ARFLAGS := cru 17 | 18 | TARGET := libfatfs-ppc.a 19 | OBJECTS := ff-ppc.o ff_utf8-ppc.o option/ccsbcs-ppc.o 20 | 21 | .PHONY: FORCE 22 | 23 | all: $(TARGET) 24 | 25 | -include $(OBJECTS:.o=.d) 26 | 27 | $(TARGET): $(OBJECTS) 28 | @echo "AR $@" 29 | @$(AR) $(ARFLAGS) $@ $(OBJECTS) 30 | 31 | %-ppc.o : %.c 32 | @echo "CC $@" 33 | @$(CC) $(CFLAGS) -c -MMD -MP -MF $(@:.o=.d) -o $@ $< 34 | 35 | clean: 36 | -$(RM) -f *-ppc.a *-ppc.o *-ppc.d option/*-ppc.o option/*-ppc.d 37 | -------------------------------------------------------------------------------- /fatfs/ff_utf8.h: -------------------------------------------------------------------------------- 1 | // Nintendont: FatFs UTF-8 wrapper functions. 2 | #ifndef _FATFS_UTF8 3 | #define _FATFS_UTF8 4 | 5 | #include "ff.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #include "ff.h" 12 | 13 | /** 14 | * Convert a 16-bit WCHAR string to UTF-8. 15 | * @param in WCHAR string. 16 | * @return UTF-8 string. (STATIC BUFFER; use immediately, DO NOT FREE!) 17 | */ 18 | const char *wchar_to_char(const WCHAR *wcs); 19 | 20 | FRESULT f_open_char(FIL* fp, const char* path, BYTE mode); 21 | FRESULT f_mount_char(FATFS* fs, const char* path, BYTE opt); 22 | 23 | #if !_FS_READONLY 24 | FRESULT f_mkdir_char(const char* path); 25 | #endif /* !_FS_READONLY */ 26 | 27 | #if _FS_RPATH >= 1 28 | #if _VOLUMES >= 2 29 | FRESULT f_chdrive_char(const char* path); 30 | #endif /* _VOLUMES >= 2 */ 31 | FRESULT f_chdir_char(const char* path); 32 | #endif /* _FS_RPATH >= 1 */ 33 | 34 | #if _FS_MINIMIZE <= 1 35 | FRESULT f_opendir_char(DIR* dp, const char* path); 36 | #endif /* _FS_MINIMIZE <= 1 */ 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _FATFS_UTF8 */ 43 | -------------------------------------------------------------------------------- /fatfs/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _FF_INTEGER 6 | #define _FF_INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | typedef unsigned __int64 QWORD; 13 | 14 | 15 | #else /* Embedded platform */ 16 | 17 | /* These types MUST be 16-bit or 32-bit */ 18 | typedef int INT; 19 | typedef unsigned int UINT; 20 | 21 | /* This type MUST be 8-bit */ 22 | typedef unsigned char BYTE; 23 | 24 | /* These types MUST be 16-bit */ 25 | typedef short SHORT; 26 | typedef unsigned short WORD; 27 | typedef unsigned short WCHAR; 28 | 29 | /* These types MUST be 32-bit */ 30 | typedef long LONG; 31 | typedef unsigned long DWORD; 32 | 33 | /* This type MUST be 64-bit (Remove this for C89 compatibility) */ 34 | typedef unsigned long long QWORD; 35 | 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /kernel/Config.c: -------------------------------------------------------------------------------- 1 | #include "Config.h" 2 | #include "debug.h" 3 | #include "ff_utf8.h" 4 | 5 | // BI2.bin region code. 6 | u32 BI2region = 0; 7 | 8 | void ConfigSyncBeforeRead( void ) 9 | { 10 | sync_before_read(ncfg, sizeof(NIN_CFG)); 11 | } 12 | 13 | void ConfigInit( void ) 14 | { 15 | FIL cfg; 16 | u32 read; 17 | 18 | dbgprintf("CFGInit()\r\n"); 19 | ConfigSyncBeforeRead(); 20 | if (ncfg->Magicbytes != 0x01070CF6) 21 | { 22 | dbgprintf("Cfg not in memory, trying file\r\n"); 23 | if (f_open_char(&cfg, "/nincfg.bin", FA_OPEN_EXISTING | FA_READ) != FR_OK) 24 | { 25 | dbgprintf("CFG:Failed to open config\r\n"); 26 | Shutdown(); 27 | } 28 | 29 | f_read( &cfg, ncfg, sizeof(NIN_CFG), &read ); 30 | sync_after_write(ncfg, sizeof(NIN_CFG)); 31 | f_close( &cfg ); 32 | 33 | if( read != sizeof(NIN_CFG) ) 34 | { 35 | dbgprintf("CFG:Failed to read config\r\n"); 36 | Shutdown(); 37 | } 38 | ConfigSyncBeforeRead(); 39 | } 40 | 41 | if( IsWiiU() ) 42 | { 43 | //ncfg->Config |= NIN_CFG_HID; 44 | ncfg->MaxPads = 0; 45 | 46 | // Disable debugging and the drive access LED. 47 | ncfg->Config &= ~(NIN_CFG_DEBUGGER | NIN_CFG_DEBUGWAIT | NIN_CFG_LED); 48 | } 49 | 50 | //if( (read32(0) >> 8) == 0x47504F ) // PSO 1&2 disable cheats/debugging 51 | //{ 52 | // ncfg->Config &= ~(NIN_CFG_CHEATS|NIN_CFG_DEBUGGER|NIN_CFG_DEBUGWAIT); 53 | //} 54 | } 55 | -------------------------------------------------------------------------------- /kernel/FST.h: -------------------------------------------------------------------------------- 1 | #ifndef __FST_H__ 2 | #define __FST_H__ 3 | 4 | #include "global.h" 5 | #include "ff.h" 6 | 7 | #define FILECACHE_MAX 2 8 | 9 | u32 FSTInit( const char *GamePath ); 10 | void FSTCleanup( void ); 11 | const u8* FSTRead( const char *GamePath, u32* Length, u32 Offset ); 12 | 13 | void CacheInit( char *Table, bool ForceReinit ); 14 | void CacheFile( const char *FileName, char *Table ); 15 | const u8* CacheRead( u32* Length, u32 Offset ); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /kernel/GCAM.h: -------------------------------------------------------------------------------- 1 | #ifndef __GCAM_H__ 2 | #define __GCAM_H__ 3 | 4 | #include "string.h" 5 | #include "global.h" 6 | #include "alloc.h" 7 | #include "vsprintf.h" 8 | 9 | #define GCAM_BASE 0x13026100 10 | 11 | #define GCAM_CMD (GCAM_BASE+0x00) 12 | #define GCAM_CMD_1 (GCAM_BASE+0x04) 13 | #define GCAM_CMD_2 (GCAM_BASE+0x08) 14 | #define GCAM_CMD_3 (GCAM_BASE+0x0C) 15 | #define GCAM_CMD_4 (GCAM_BASE+0x10) 16 | #define GCAM_RETURN (GCAM_BASE+0x14) 17 | #define GCAM_CONTROL (GCAM_BASE+0x18) 18 | #define GCAM_STATUS (GCAM_BASE+0x1C) 19 | 20 | #define GCAM_SHADOW (GCAM_BASE + 0x20) 21 | 22 | #define GCAM_SCMD (GCAM_SHADOW+0x00) 23 | #define GCAM_SCMD_1 (GCAM_SHADOW+0x04) 24 | #define GCAM_SCMD_2 (GCAM_SHADOW+0x08) 25 | #define GCAM_SCMD_3 (GCAM_SHADOW+0x0C) 26 | #define GCAM_SCMD_4 (GCAM_SHADOW+0x10) 27 | #define GCAM_SRETURN (GCAM_SHADOW+0x14) 28 | #define GCAM_SCONTROL (GCAM_SHADOW+0x18) 29 | #define GCAM_SSTATUS (GCAM_SHADOW+0x1C) 30 | 31 | enum CARDCommands 32 | { 33 | CARD_INIT = 0x10, 34 | CARD_GET_CARD_STATE = 0x20, 35 | CARD_IS_PRESENT = 0x40, 36 | CARD_LOAD_CARD = 0xB0, 37 | CARD_CLEAN_CARD = 0xA0, 38 | CARD_READ = 0x33, 39 | CARD_WRITE = 0x53, 40 | CARD_WRITE_INFO = 0x7C, 41 | CARD_78 = 0x78, 42 | CARD_7A = 0x7A, 43 | CARD_7D = 0x7D, 44 | CARD_D0 = 0xD0, 45 | CARD_80 = 0x80, 46 | }; 47 | 48 | void GCAMInit( void ); 49 | void GCAMCARDCleanStatus( u32 status ); 50 | void GCAMUpdateRegisters( void ); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /kernel/GCPad.h: -------------------------------------------------------------------------------- 1 | #ifndef __GCPAD_H__ 2 | #define __GCPAD_H__ 3 | 4 | typedef struct 5 | { 6 | union 7 | { 8 | struct 9 | { 10 | bool ErrorStatus :1; 11 | bool ErrorLatch :1; 12 | u32 Reserved :1; 13 | bool Start :1; 14 | 15 | bool Y :1; 16 | bool X :1; 17 | bool B :1; 18 | bool A :1; 19 | 20 | u32 AlwaysSet :1; 21 | bool R :1; 22 | bool L :1; 23 | bool Z :1; 24 | 25 | bool Up :1; 26 | bool Down :1; 27 | bool Right :1; 28 | bool Left :1; 29 | 30 | s16 StickX :8; 31 | s16 StickY :8; 32 | }; 33 | u32 Buttons; 34 | }; 35 | union 36 | { 37 | struct 38 | { 39 | s16 CStickX; 40 | s16 CStickY; 41 | s16 LShoulder; 42 | s16 RShoulder; 43 | }; 44 | u32 Sticks; 45 | }; 46 | } GCPadStatus; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /kernel/ISO.h: -------------------------------------------------------------------------------- 1 | /* 2 | ISO.h for Nintendont (Kernel) 3 | 4 | Copyright (C) 2014 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #ifndef _CACHEISO_H_ 20 | #define _CACHEISO_H_ 21 | 22 | extern bool Datel; 23 | 24 | bool ISOInit(); 25 | void ISOClose(); 26 | void ISOSetupCache(); 27 | const u8 *ISORead(u32* Length, u32 Offset); 28 | void ISOSeek(u32 Offset); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /kernel/JVSIO.h: -------------------------------------------------------------------------------- 1 | #ifndef __JVSIO_H__ 2 | #define __JVSIO_H__ 3 | 4 | #include "global.h" 5 | 6 | void JVSIOCommand( char *DataIn, char *DataOut ); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /kernel/JVSIOMessage.c: -------------------------------------------------------------------------------- 1 | #include "JVSIOMessage.h" 2 | 3 | vu32 m_ptr, m_last_start, m_csum; 4 | vu8 m_msg[0x80]; 5 | 6 | void JVSIOMessage(void) 7 | { 8 | m_ptr = 0; 9 | m_last_start = 0; 10 | m_csum = 0; 11 | } 12 | void JVSIOstart(int node) 13 | { 14 | m_last_start = m_ptr; 15 | unsigned char hdr[3] = {0xe0, node, 0}; 16 | m_csum = 0; 17 | addData(hdr, 3, 1); 18 | } 19 | void addDataBuffer(const void *data, size_t len) 20 | { 21 | addData(data, len, 0); 22 | } 23 | void addDataString(const char *data) 24 | { 25 | addDataBuffer(data, strlen(data)); 26 | } 27 | void addDataByte(const u8 data) 28 | { 29 | addDataBuffer(&data, 1); 30 | } 31 | 32 | void end() 33 | { 34 | u32 len = m_ptr - m_last_start; 35 | m_msg[m_last_start + 2] = len - 2; // assuming len <0xD0 36 | addDataByte(m_csum + len - 2); 37 | } 38 | 39 | void addData(const void *data, size_t len, int sync) 40 | { 41 | vu8 *dst = (vu8*)data; 42 | while (len--) 43 | { 44 | int c = *dst++; 45 | if (!sync && ((c == 0xE0) || (c == 0xD0))) 46 | { 47 | m_msg[m_ptr++] = 0xD0; 48 | m_msg[m_ptr++] = c - 1; 49 | } else 50 | m_msg[m_ptr++] = c; 51 | if (!sync) 52 | m_csum += c; 53 | sync = 0; 54 | 55 | //if (m_ptr >= 0x80) 56 | // dbgprintf("JVSIOMessage overrun!"); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /kernel/JVSIOMessage.h: -------------------------------------------------------------------------------- 1 | #ifndef __JVCIO__ 2 | #define __JVCIO__ 3 | 4 | #include "global.h" 5 | #include "string.h" 6 | 7 | void JVSIOMessage(void); 8 | void JVSIOstart(int node); 9 | void addDataBuffer(const void *data, size_t len); 10 | void addDataString(const char *data); 11 | void addDataByte(const u8 data); 12 | void end(); 13 | void addData(const void *data, size_t len, int sync); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /kernel/NAND.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | SNEEK - SD-NAND/ES emulation kit for Nintendo Wii 4 | 5 | Copyright (C) 2009-2011 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #ifndef __NAND_H__ 22 | #define __NAND_H__ 23 | 24 | #include "global.h" 25 | #include "string.h" 26 | #include "common.h" 27 | 28 | u8 *NANDLoadFile( char * path, u32 *Size ); 29 | 30 | #endif -------------------------------------------------------------------------------- /kernel/NinPattern/NinPattern.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/kernel/NinPattern/NinPattern.exe -------------------------------------------------------------------------------- /kernel/NinPattern/README.md: -------------------------------------------------------------------------------- 1 | Small helper tool I wrote up back in 2014 used to generate the function patterns used in patches.c 2 | Simply copy the function data from the game executable you want to get the pattern of into a "func.bin" with a hex editor, 3 | place it into the same folder as NinPattern and then run NinPattern from command line to get the array data for patches.c -------------------------------------------------------------------------------- /kernel/NinPattern/make_ninpattern.bat: -------------------------------------------------------------------------------- 1 | 2 | @echo off 3 | gcc main.c -s -O2 -static -o NinPattern 4 | -------------------------------------------------------------------------------- /kernel/Patch.h: -------------------------------------------------------------------------------- 1 | #ifndef __PATCH_H__ 2 | #define __PATCH_H__ 3 | 4 | #include "global.h" 5 | 6 | #define VI_NTSC 0 7 | #define VI_PAL 1 8 | #define VI_MPAL 2 9 | #define VI_DEBUG 3 10 | #define VI_DEBUG_PAL 4 11 | #define VI_EUR60 5 12 | #define VI_480P 6 13 | 14 | #define GXPal528IntDf 0 15 | #define GXEurgb60Hz480IntDf 1 16 | #define GXMpal480IntDf 2 17 | #define GXNtsc480IntDf 3 18 | #define GXNtsc480Int 4 19 | #define GXNtsc480Prog 5 20 | #define GXPal528Prog 6 21 | #define GXEurgb60Hz480Prog 7 22 | 23 | typedef struct FuncPattern 24 | { 25 | u32 Length; 26 | u32 Loads; 27 | u32 Stores; 28 | u32 FCalls; 29 | u32 Branch; 30 | u32 Moves; 31 | const void *Patch; 32 | u32 PatchLength; 33 | const char *Name; 34 | const char *Type; 35 | u32 Group; 36 | u32 Found; 37 | } FuncPattern; 38 | 39 | typedef struct FuncPatterns 40 | { 41 | FuncPattern *pat; 42 | u32 patlen; 43 | u32 patmode; 44 | } FuncPatterns; 45 | 46 | void PatchB( u32 dst, u32 src ); 47 | void PatchBL( u32 dst, u32 src ); 48 | u32 PatchCopy(const u8 *PatchPtr, const u32 PatchSize); 49 | s32 PatchFunc( char *ptr ); 50 | void PatchFuncInterface( char *dst, u32 Length ); 51 | void PatchPatchBuffer(char *dst); 52 | void CheckPatchPrs(); 53 | s32 Check_Cheats(); 54 | 55 | void DoCardPatches( char *ptr, u32 size ); 56 | void DoPatches( char *Buffer, u32 Length, u32 Offset ); 57 | void SetIPL(); 58 | void SetIPL_TRI(); 59 | 60 | void PatchInit(); 61 | void PatchGame(); 62 | 63 | void MPattern( u8 *Data, u32 Length, FuncPattern *FunctionPattern ); 64 | int CPattern( FuncPattern *FPatA, FuncPattern *FPatB ); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /kernel/PatchTimers.h: -------------------------------------------------------------------------------- 1 | /* 2 | PatchTimers.c for Nintendont (Kernel) 3 | 4 | Copyright (C) 2014 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef _PATCHTIMERS_H_ 21 | #define _PATCHTIMERS_H_ 22 | 23 | bool PatchTimers(u32 FirstVal, u32 Buffer, bool checkFloats); 24 | void PatchStaticTimers(); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /kernel/PatchWidescreen.h: -------------------------------------------------------------------------------- 1 | /* 2 | PatchWidescreen.c for Nintendont (Kernel) 3 | 4 | Copyright (C) 2014 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #ifndef _PATCHWIDESCREEN_H_ 20 | #define _PATCHWIDESCREEN_H_ 21 | 22 | bool PatchWidescreen(u32 FirstVal, u32 Buffer); 23 | void PatchWideMulti(u32 BufferPos, u32 dstReg); 24 | 25 | /** 26 | * Apply a static widescreen patch. 27 | * @param TitleID Game ID, rshifted by 8. 28 | * @param Region Region byte from Game ID. 29 | * @return True if a patch was applied; false if not. 30 | */ 31 | bool PatchStaticWidescreen(u32 TitleID, u32 Region); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /kernel/ReadSpeed.h: -------------------------------------------------------------------------------- 1 | /* 2 | ReadSpeed.h for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #ifndef _READSPEED_H_ 20 | #define _READSPEED_H_ 21 | 22 | void ReadSpeed_Init(); 23 | void ReadSpeed_Motor(); 24 | void ReadSpeed_Start(); 25 | void ReadSpeed_Setup(u32 Offset, int Length); 26 | u32 ReadSpeed_End(); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /kernel/RealDI.h: -------------------------------------------------------------------------------- 1 | /* 2 | RealDI.h for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef _REALDI_H_ 21 | #define _REALDI_H_ 22 | 23 | #define DIP_CMD_NORMAL 0xA8 24 | #define DIP_CMD_DVDR 0xD0 25 | 26 | void RealDI_Init(); 27 | void RealDI_Update(); 28 | void RealDI_Identify(bool NeedsGC); 29 | bool RealDI_NewDisc(); 30 | void ClearRealDiscBuffer(void); 31 | const u8 *ReadRealDisc(u32 *Length, u32 Offset, bool NeedSync); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /kernel/SI.h: -------------------------------------------------------------------------------- 1 | /* 2 | SI.h for Nintendont (Kernel) 3 | 4 | Copyright (C) 2014 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #ifndef __SI_H__ 20 | #define __SI_H__ 21 | 22 | #define SI_BASE 0x13026400 23 | 24 | #define SI_CHAN_0 (SI_BASE+0x00) 25 | #define SI_CHAN_1 (SI_BASE+0x0C) 26 | #define SI_CHAN_2 (SI_BASE+0x18) 27 | #define SI_CHAN_3 (SI_BASE+0x24) 28 | #define SI_POLL (SI_BASE+0x30) 29 | #define SI_CONTROL (SI_BASE+0x34) 30 | #define SI_STATUS (SI_BASE+0x38) 31 | #define SI_EXI_LOCK (SI_BASE+0x3C) 32 | #define SI_IO_BUF (SI_BASE+0x80) 33 | 34 | #define PAD_BUFF 0x13003100 35 | 36 | void SIInit(); 37 | void SIInterrupt(); 38 | void SIUpdateRegisters(); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /kernel/SRAM.h: -------------------------------------------------------------------------------- 1 | // Nintendont: SRAM functions. 2 | #ifndef __SRAM_H__ 3 | #define __SRAM_H__ 4 | 5 | #include "global.h" 6 | 7 | // GameCube SRAM data. 8 | typedef struct _GC_SRAM 9 | { 10 | /* 0x00 */ u16 CheckSum1; 11 | /* 0x02 */ u16 CheckSum2; 12 | /* 0x04 */ u32 ead0; 13 | /* 0x08 */ u32 ead1; 14 | /* 0x0C */ u32 CounterBias; 15 | /* 0x10 */ u8 DisplayOffsetH; 16 | /* 0x11 */ u8 BootMode; // Bit 6 PAL60 flag 17 | /* 0x12 */ u8 Language; 18 | /* 0x13 */ u8 Flags; 19 | /* 20 | bit desc 0 1 21 | 0 -\_ Video mode 22 | 1 -/ 23 | 2 Sound mode Mono Stereo 24 | 3 always 1 25 | 4 always 0 26 | 5 always 1 27 | 6 ? 28 | 7 Prog mode off on 29 | */ 30 | /* 0x14 */ u8 FlashID[2][12]; 31 | /* 0x2C */ u32 WirelessKBID; 32 | /* 0x30 */ u16 WirlessPADID[4]; 33 | /* 0x38 */ u8 LastDVDError; 34 | /* 0x39 */ u8 Reserved; 35 | /* 0x3A */ u8 FlashIDChecksum[2]; 36 | /* 0x3E */ u32 Unused; 37 | } GC_SRAM; 38 | 39 | // Emulated SRAM instance. 40 | extern GC_SRAM sram; 41 | 42 | /** 43 | * Update the SRAM checksum. 44 | */ 45 | void SRAM_UpdateChecksum(void); 46 | 47 | /** 48 | * Initialize SRAM. 49 | */ 50 | void SRAM_Init(void); 51 | 52 | /** 53 | * Set the flash ID of a memory card in SRAM. 54 | * @param base Memory card base address. 55 | * @param slot Slot number. (0 or 1) 56 | */ 57 | void SRAM_SetFlashID(const u8 *base, int slot); 58 | 59 | #endif /* __SRAM_H__ */ 60 | -------------------------------------------------------------------------------- /kernel/Stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | Stream.c for Nintendont (Kernel) 3 | 4 | Copyright (C) 2014 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef _STREAM_H_ 21 | #define _STREAM_H_ 22 | 23 | #include "global.h" 24 | 25 | enum 26 | { 27 | ONE_BLOCK_SIZE = 32, 28 | SAMPLES_PER_BLOCK = 28 29 | }; 30 | 31 | void StreamInit(); 32 | void StreamStartStream(u32 CurrentStart, u32 CurrentSize); 33 | void StreamEndStream(); 34 | void StreamUpdateRegisters(); 35 | void StreamPrepare(); 36 | void StreamUpdate(); 37 | u32 StreamGetChunkSize(); 38 | 39 | typedef void (*PCMWriter)(); 40 | void WritePCM48to32(); 41 | void WritePCM48(); 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /kernel/TRI.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Kernel) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | Copyright (C) 2014-2015 FIX94 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation version 2. 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 for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | 21 | */ 22 | #ifndef _TRI_H_ 23 | #define _TRI_H_ 24 | 25 | void TRIInit(); 26 | void TRIReset(); 27 | void TRIReadSettings(); 28 | void TRIBackupSettings(); 29 | void TRISetupGames(); 30 | void TRIPatchGCAMSendCommand(); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /kernel/WPad.h: -------------------------------------------------------------------------------- 1 | #ifndef __WPAD_H__ 2 | #define __WPAD_H__ 3 | 4 | #define WPAD_BUTTON_LEFT 0x0001 5 | #define WPAD_BUTTON_RIGHT 0x0002 6 | #define WPAD_BUTTON_DOWN 0x0004 7 | #define WPAD_BUTTON_UP 0x0008 8 | #define WPAD_BUTTON_PLUS 0x0010 9 | 10 | #define WPAD_BUTTON_2 0x0100 11 | #define WPAD_BUTTON_1 0x0200 12 | #define WPAD_BUTTON_B 0x0400 13 | #define WPAD_BUTTON_A 0x0800 14 | #define WPAD_BUTTON_MINUS 0x1000 15 | #define WPAD_BUTTON_Z 0x2000 16 | #define WPAD_BUTTON_C 0x4000 17 | #define WPAD_BUTTON_HOME 0x8000 18 | 19 | #endif -------------------------------------------------------------------------------- /kernel/adp.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | in_cube Gamecube Stream Player for Winamp 4 | by hcs 5 | 6 | includes work by Destop and bero 7 | 8 | */ 9 | 10 | #ifndef _ADP_H_ 11 | #define _ADP_H_ 12 | 13 | // DLS (a.k.a. DTK, TRK, ADP) 14 | // uses same algorithm as XA, apparently 15 | // ADP decoder function by hcs, reversed from dtkmake (trkmake v1.4) 16 | 17 | // decode 32 bytes of input (28 samples), assume stereo 18 | int ADPdecodebuffer(unsigned char *input, short *outl, short * outr, long *histl1, long *histl2, long *histr1, long *histr2); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /kernel/alloc.c: -------------------------------------------------------------------------------- 1 | #include "global.h" 2 | #include "alloc.h" 3 | #include "vsprintf.h" 4 | #include "debug.h" 5 | 6 | void *malloc( u32 size ) 7 | { 8 | void *ptr = heap_alloc( 0, size ); 9 | if( ptr == NULL ) 10 | { 11 | //dbgprintf("Malloc:%p Size:%08X FAILED\r\n", ptr, size ); 12 | Shutdown(); 13 | } 14 | return ptr; 15 | } 16 | void *malloca( u32 size, u32 align ) 17 | { 18 | void *ptr = heap_alloc_aligned( 0, size, align ); 19 | if( ptr == NULL ) 20 | { 21 | //dbgprintf("Malloca:%p Size:%08X FAILED\r\n", ptr, size ); 22 | Shutdown(); 23 | } 24 | return ptr; 25 | } 26 | void free( void *ptr ) 27 | { 28 | if( ptr != NULL ) 29 | heap_free( 0, ptr ); 30 | 31 | //dbgprintf("Free:%p\r\n", ptr ); 32 | 33 | return; 34 | } -------------------------------------------------------------------------------- /kernel/alloc.h: -------------------------------------------------------------------------------- 1 | #ifndef __ALLOC_H__ 2 | #define __ALLOC_H__ 3 | 4 | void *malloc( u32 size ); 5 | void *malloca( u32 size, u32 align ); 6 | void free( void *ptr ); 7 | 8 | #endif -------------------------------------------------------------------------------- /kernel/asm/ARStartDMA_Hook.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | .set AR_DMA_SAVE, 0x931C0040 4 | 5 | .set OSReport, 0xC0001860 6 | .set AR_DBG, 0x930031A0 7 | 8 | #in 9 | # r29 u32 type 10 | # r28 u32 mainmem_addr 11 | # r30 u32 aram_addr 12 | # r31 u32 length 13 | 14 | #out 15 | # none 16 | 17 | ARStartDMA: 18 | # stwu %sp, -0x20(%sp) 19 | # stw r7, 0xC(%sp) 20 | # stw r8, 0x10(%sp) 21 | 22 | # lis r7, OSReport@h 23 | # ori r7, r7, OSReport@l 24 | # stw r28, 4(r7) 25 | # stw r30, 8(r7) 26 | # stw r31, 12(r7) 27 | 28 | # lis r8, AR_DBG@h 29 | # ori r8, r8, AR_DBG@l 30 | # stw r8, 0(r7) 31 | #repeatprint: 32 | # lwz r6, 0(r7) 33 | # cmpw r6, r8 34 | # beq repeatprint 35 | 36 | # lwz r7, 0xC(%sp) 37 | # lwz r8, 0x10(%sp) 38 | # addi %sp, %sp, 0x20 39 | 40 | lis r6, AR_DMA_SAVE@h 41 | stwu r29, AR_DMA_SAVE@l(r6) 42 | stwu r28, 4(r6) 43 | stwu r30, 4(r6) 44 | stw r31, 4(r6) 45 | 46 | lis r6, 0xCC00 47 | blr 48 | -------------------------------------------------------------------------------- /kernel/asm/CalcGXWidescreen.S: -------------------------------------------------------------------------------- 1 | /* 2 | CalcGXWidescreen.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | CalcGXWidescreen: 22 | stwu %sp, -0x20(%sp) 23 | stw r30, 0x4(%sp) 24 | stw r4, 0x8(%sp) 25 | stfd %f31, 0xC(%sp) 26 | mflr r30 27 | lfs %f0, 4(r31) 28 | lfs %f31, 0x18(r31) 29 | fdivs %f0, %f31, %f0 30 | bl GetFloatBase 31 | .long 0x3faaaaab #4/3 32 | GetFloatBase: 33 | mflr r4 34 | lfs %f31, 0(r4) 35 | MulAspect: 36 | fmuls %f0, %f31, %f0 37 | end: 38 | lfs %f31, 0x18(r31) 39 | fdivs %f0, %f31, %f0 40 | stfs %f0, 4(r31) 41 | mtlr r30 42 | lwz r30, 0x4(%sp) 43 | lwz r4, 0x8(%sp) 44 | lfd %f31, 0xC(%sp) 45 | addi %sp, %sp, 0x20 46 | nop #original instruction 47 | nop #b original code 48 | -------------------------------------------------------------------------------- /kernel/asm/CalcWidescreen.S: -------------------------------------------------------------------------------- 1 | /* 2 | CalcWidescreen.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2014 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | CalcWidescreen: 22 | nop #original instruction 23 | stwu %sp, -0x20(%sp) 24 | stw r30, 0x4(%sp) 25 | stw r31, 0x8(%sp) 26 | stfd %f31, 0xC(%sp) 27 | mflr r30 28 | bl GetFloatBase 29 | .long 0x3faaaaab #4/3 30 | GetFloatBase: 31 | mflr r31 32 | lfs %f31, 0(r31) 33 | MulAspect: 34 | fmuls %f3, %f31, %f3 #gets replaced with float we want 35 | end: 36 | mtlr r30 37 | lwz r30, 0x4(%sp) 38 | lwz r31, 0x8(%sp) 39 | lfd %f31, 0xC(%sp) 40 | addi %sp, %sp, 0x20 41 | nop #b original code 42 | -------------------------------------------------------------------------------- /kernel/asm/CalcWidescreenDiv.S: -------------------------------------------------------------------------------- 1 | /* 2 | CalcWidescreenDiv.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | CalcWidescreen: 22 | nop #original instruction 23 | stwu %sp, -0x20(%sp) 24 | stw r30, 0x4(%sp) 25 | stw r31, 0x8(%sp) 26 | stfd %f31, 0xC(%sp) 27 | mflr r30 28 | bl GetFloatBase 29 | .long 0x3f400000 #3/4 30 | GetFloatBase: 31 | mflr r31 32 | lfs %f31, 0(r31) 33 | MulAspect: 34 | fmuls %f3, %f31, %f3 #gets replaced with float we want 35 | end: 36 | mtlr r30 37 | lwz r30, 0x4(%sp) 38 | lwz r31, 0x8(%sp) 39 | lfd %f31, 0xC(%sp) 40 | addi %sp, %sp, 0x20 41 | nop #b original code 42 | -------------------------------------------------------------------------------- /kernel/asm/CheckTestMenu.S: -------------------------------------------------------------------------------- 1 | /* 2 | CheckTestMenu.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | .include "constants.inc" 21 | 22 | #r3 gets overwritten later 23 | 24 | CheckTestMenu: 25 | lis r3, IN_TESTMENU@h 26 | cmpwi r0, 0 27 | bne DoCheck 28 | b end #No Test Menu, just exit 29 | DoCheck: #Test Menu requested, make sure it wasnt loaded 30 | lwz r0, IN_TESTMENU@l(r3) 31 | cmpwi r0, 0 32 | bne Disallow 33 | Allow: #Not loaded previously, enter test menu 34 | li r0, 1 35 | b end 36 | Disallow: #Test Menu previously loaded so disallow 37 | li r0, 0 38 | end: #Always save current status for next time 39 | stw r0, IN_TESTMENU@l(r3) 40 | blr 41 | -------------------------------------------------------------------------------- /kernel/asm/CheckTestMenuGP.S: -------------------------------------------------------------------------------- 1 | /* 2 | CheckTestMenuGP.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2016 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | .include "constants.inc" 21 | 22 | #r3 gets overwritten later 23 | 24 | CheckTestMenuGP: 25 | #original instruction 26 | clrlwi r0, r26, 24 27 | 28 | lis r26, IN_TESTMENU@h 29 | cmpwi r0, 0 30 | bne DoCheck 31 | b end #No Test Menu, just exit 32 | DoCheck: #Test Menu requested, make sure it wasnt loaded 33 | lwz r0, IN_TESTMENU@l(r26) 34 | cmpwi r0, 0 35 | bne Disallow 36 | Allow: #Not loaded previously, enter test menu 37 | li r0, 1 38 | b end 39 | Disallow: #Test Menu previously loaded so disallow 40 | li r0, 0 41 | end: #Always save current status for next time 42 | stw r0, IN_TESTMENU@l(r26) 43 | blr 44 | -------------------------------------------------------------------------------- /kernel/asm/CheckTestMenuVS.S: -------------------------------------------------------------------------------- 1 | /* 2 | CheckTestMenuVS.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | .include "constants.inc" 21 | 22 | #r6 is unused at this point 23 | 24 | CheckTestMenu: 25 | #original instruction 26 | srwi r0, r0, 5 27 | 28 | lis r6, IN_TESTMENU@h 29 | cmpwi r0, 0 30 | bne DoCheck 31 | b end #No Test Menu, just exit 32 | DoCheck: #Test Menu requested, make sure it wasnt loaded 33 | lwz r0, IN_TESTMENU@l(r6) 34 | cmpwi r0, 0 35 | bne Disallow 36 | Allow: #Not loaded previously, enter test menu 37 | li r0, 1 38 | b end 39 | Disallow: #Test Menu previously loaded so disallow 40 | li r0, 0 41 | end: #Always save current status for next time 42 | stw r0, IN_TESTMENU@l(r6) 43 | blr 44 | -------------------------------------------------------------------------------- /kernel/asm/CheckTestMenuYakyuu.S: -------------------------------------------------------------------------------- 1 | /* 2 | CheckTestMenuYakyuu.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | .include "constants.inc" 21 | 22 | #r6 is unused at this point 23 | 24 | CheckTestMenu: 25 | #original instruction 26 | extrwi r0, r0, 8,19 27 | 28 | lis r6, IN_TESTMENU@h 29 | cmpwi r0, 0 30 | bne DoCheck 31 | b end #No Test Menu, just exit 32 | DoCheck: #Test Menu requested, make sure it wasnt loaded 33 | lwz r0, IN_TESTMENU@l(r6) 34 | cmpwi r0, 0 35 | bne Disallow 36 | Allow: #Not loaded previously, enter test menu 37 | li r0, 1 38 | b end 39 | Disallow: #Test Menu previously loaded so disallow 40 | li r0, 0 41 | end: #Always save current status for next time 42 | stw r0, IN_TESTMENU@l(r6) 43 | blr 44 | -------------------------------------------------------------------------------- /kernel/asm/DHCP_get_dns.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | DHCP_get_dns: 5 | lis 0, DHCP_get_dns_Addr@h 6 | ori 0, 0, DHCP_get_dns_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/DHCP_get_gateway.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | DHCP_get_gateway: 5 | lis 0, DHCP_get_gateway_Addr@h 6 | ori 0, 0, DHCP_get_gateway_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/DHCP_release.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | DHCP_release: 5 | lis 0, DHCP_release_Addr@h 6 | ori 0, 0, DHCP_release_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/DHCP_request_nb.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | DHCP_request_nb: 5 | lis 0, DHCP_request_nb_Addr@h 6 | ori 0, 0, DHCP_request_nb_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/DVDSendCMDEncrypted.S: -------------------------------------------------------------------------------- 1 | /* 2 | DVDSendCMDEncrypted.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2016 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | .include "constants.inc" 21 | 22 | DVDSendCMDEncrypted: 23 | lis r6, DI_BASE@h 24 | ori r6, r6, DI_BASE@l 25 | rotrwi r3, r3, 8 #GC Norm 26 | stw r3, 0x08(r6) #DI_CMD_0 27 | stw r4, 0x0C(r6) #DI_CMD_1 28 | stw r5, 0x10(r6) #DI_CMD_2 29 | blr 30 | -------------------------------------------------------------------------------- /kernel/asm/DatelTimer.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #.set DATEL_TIMER, 0x00013800 # 0x6800 * 3 4 | .set DATEL_TIMER, 0x00009C00 # 0x6800 * 3 / 2 5 | 6 | DatelTimer: 7 | li r0, DATEL_TIMER@h 8 | ori r0, r0, DATEL_TIMER@l 9 | mtctr r0 10 | DatelTimerWait: 11 | bdnz DatelTimerWait 12 | 13 | blr 14 | -------------------------------------------------------------------------------- /kernel/asm/EXIDMA.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #in 4 | # r3 channel 5 | # r4 data 6 | # r5 len 7 | # r6 mode 8 | # r7 cb 9 | 10 | #out 11 | # r3 res 12 | 13 | .include "constants.inc" 14 | 15 | .set CH0_MASK, 0x60 16 | .set CH1_MASK, 0xC 17 | .set CH_LENGTH, 0x38 18 | 19 | EXIDMA: 20 | lis r8, 0x803F 21 | addi r8, r8, 0x0CB4 22 | cmpwi r3, 1 23 | bne CallbackSet 24 | addi r8, r8, CH_LENGTH #mult instead? break channel2? 25 | CallbackSet: 26 | stw r7, 0x4(r8) # callback 27 | 28 | lis r8, CH0_MASK 29 | cmpwi r3, 1 30 | bne MaskSet 31 | lis r8, CH1_MASK 32 | MaskSet: 33 | lis r7, 0xD302 34 | lis r0, 0x1200 35 | 36 | slwi r3, r3, 20 37 | slwi r6, r6, 16 38 | 39 | or r0, r0, r3 40 | or r0, r0, r5 41 | or r0, r0, r6 42 | 43 | stw r4, EXI_CMD_1@l(r7) 44 | 45 | ## IRQ function call 46 | lis r3, 0x8000 47 | lwz r4, 0xC4(r3) 48 | 49 | andc r4, r4, r8 50 | 51 | stw r4, 0xC4(r3) 52 | 53 | stw r0, EXI_CMD_0@l(r7) 54 | ready_loop: 55 | lwz r3, EXI_CMD_0@l(r7) 56 | cmpw r3, r0 57 | beq ready_loop 58 | 59 | li r3, 1 60 | blr 61 | -------------------------------------------------------------------------------- /kernel/asm/EXIGetID.S: -------------------------------------------------------------------------------- 1 | # EXIGetID(): Get the ID of an EXI device. 2 | # Input: 3 | # - r3: Channel number. 4 | # - r4: Device number. 5 | # - r5: ID buffer. 6 | # Output: 7 | # - r3: Device ID, or 0 if not valid. 8 | 9 | #include 10 | .include "constants.inc" 11 | 12 | EXIGetID: 13 | # Check for device 0. 14 | # Slot A == Ch0,Dev0 15 | # Slot B == Ch1,Dev1 16 | cmpwi r4, 0 17 | beq IsDev0 18 | End: 19 | # Not device 0. 20 | li r3, 0 21 | blr 22 | 23 | IsDev0: 24 | # Check for Slot A. 25 | cmpwi r3, 0 26 | beq CardIsValid 27 | 28 | # Check for Slot B. 29 | cmpwi r3, 1 30 | bne End 31 | 32 | # Is Slot B enabled? 33 | lis r4, NinCfgConfig@h 34 | lwz r4, NinCfgConfig@l(r4) 35 | andis. r4, r4, NIN_CFG_MC_SLOTB@h # Check if a Slot B image was loaded. 36 | beq End 37 | 38 | CardIsValid: 39 | # Store 0x00000080 in the ID buffer. 40 | # FIXME: This means Memory Card 2043? 41 | li r4, 0x80 42 | stw r4, 0x0(r5) 43 | 44 | # Return the Dolphin OS global value for this channel. 45 | # Slot A info is stored at 0x800030C0. 46 | # Slot B info is stored at 0x800030C4. 47 | slwi r3, r3, 2 48 | lis r4, 0x8000 49 | or r4, r4, r3 # r4 = 0x80000000 + (channel * 4) 50 | lwz r3, 0x30C0(r4) 51 | 52 | blr 53 | -------------------------------------------------------------------------------- /kernel/asm/EXIImm.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #in 4 | # r3 channel 5 | # r4 data 6 | # r5 len 7 | # r6 mode 8 | # r7 cb 9 | 10 | #out 11 | # r3 res 12 | 13 | .include "constants.inc" 14 | 15 | EXIImm: 16 | mflr r0 17 | stw r0, 4(%sp) 18 | stwu %sp, -0x40(%sp) 19 | 20 | mr r8, r7 21 | 22 | lis r7, 0xD302 23 | 24 | lis r0, 0x1100 25 | 26 | slwi r3, r3, 20 27 | slwi r6, r6, 16 28 | 29 | or r0, r0, r3 30 | or r0, r0, r5 31 | or r0, r0, r6 32 | 33 | cmpwi r6, 0 34 | beq LdPtr 35 | 36 | cmpwi r5, 4 37 | bgt LdPtr 38 | 39 | lwz r3, 0(r4) 40 | stw r3, EXI_CMD_1@l(r7) 41 | b NPtr 42 | 43 | LdPtr: 44 | stw r4, EXI_CMD_1@l(r7) 45 | NPtr: 46 | stw r0, EXI_CMD_0@l(r7) 47 | ready_loop: 48 | lwz r3, EXI_CMD_0@l(r7) 49 | cmpw r3, r0 50 | beq ready_loop 51 | 52 | cmpwi r6, 0 53 | bne end 54 | 55 | CopyResult: 56 | lwz r3, EXI_CMD_1@l(r7) 57 | cmpwi r5, 1 58 | beq ByteWrite 59 | cmpwi r5, 2 60 | beq HalfWrite 61 | cmpwi r5, 4 62 | beq WordWrite 63 | b end 64 | ByteWrite: 65 | stb r3, 0(r4) 66 | b end 67 | HalfWrite: 68 | sth r3, 0(r4) 69 | b end 70 | WordWrite: 71 | stw r3, 0(r4) 72 | b end 73 | 74 | end: 75 | cmpwi r8, 0 76 | beq NoCB 77 | 78 | mtctr r8 79 | li r3, 0 80 | li r4, 0 81 | bctrl 82 | 83 | NoCB: 84 | li r3, 1 85 | 86 | lwz r0, 0x44(%sp) 87 | addi %sp, %sp, 0x40 88 | mtlr r0 89 | blr 90 | -------------------------------------------------------------------------------- /kernel/asm/EXILock.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #in 4 | # r3 channel 5 | 6 | #out 7 | # r3 res 8 | 9 | EXILock: 10 | 11 | li r3, 1 12 | blr 13 | -------------------------------------------------------------------------------- /kernel/asm/EXIProbe.S: -------------------------------------------------------------------------------- 1 | # EXIProbe(): Check if a device is present on the given EXI channel. 2 | # Input: 3 | # - r3: Channel number. 4 | # Output: 5 | # - r3: 1 if a device is present; 0 if no device is present. 6 | 7 | #include 8 | .include "constants.inc" 9 | 10 | EXIProbe: 11 | lis r4, NinCfgConfig@h 12 | lwz r4, NinCfgConfig@l(r4) 13 | andi. r4, r4, 0x8 # Check if memory card emulation is enabled. 14 | beq False # Memory card emulation is not enabled. 15 | 16 | cmpwi r3, 0 # Check if EXIProbe() was called for Slot A. 17 | beq True # If so, the card is definitely present. 18 | 19 | cmpwi r3, 1 # Check if EXIProbe() was called for Slot B. 20 | bne False # If not, the channel parameter is invalid. 21 | 22 | lis r4, NinCfgConfig@h 23 | lwz r4, NinCfgConfig@l(r4) 24 | andis. r4, r4, NIN_CFG_MC_SLOTB@h # Check if a Slot B image was loaded. 25 | bne True 26 | 27 | False: 28 | # No EXI device is present on this channel. 29 | li r3, 0 30 | blr 31 | 32 | True: 33 | # An EXI device is present on this channel. 34 | # Set the Dolphin OS global variable. 35 | # Slot A info is stored at 0x800030C0. 36 | # Slot B info is stored at 0x800030C4. 37 | slwi r3, r3, 2 38 | lis r4, 0x8000 39 | or r4, r4, r3 # r4 = 0x80000000 + (channel * 4) 40 | 41 | # Store the magic number 0xE2D383C1 in the OS Globals section 42 | # to indicate that a memory card is present. 43 | lis r3, 0xE2D3 44 | ori r3, r3, 0x83C1 45 | stw r3, 0x30C0(r4) 46 | 47 | # EXI device is present. 48 | li r3, 1 49 | blr 50 | -------------------------------------------------------------------------------- /kernel/asm/EXISelect.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #in 4 | # r3 channel 5 | # r4 device 6 | # r5 freq 7 | 8 | #out 9 | # r3 res 10 | 11 | .include "constants.inc" 12 | 13 | EXISelect: 14 | lis r7, 0xD302 15 | lis r0, 0x1000 16 | 17 | slwi r4, r4, 8 18 | slwi r5, r5, 16 19 | 20 | or r0, r0, r3 21 | or r0, r0, r4 22 | or r0, r0, r5 23 | 24 | stw r0, EXI_CMD_0@l(r7) 25 | 26 | ready_loop: 27 | lwz r3, EXI_CMD_0@l(r7) 28 | cmpw r3, r0 29 | beq ready_loop 30 | 31 | lwz r3, EXI_CMD_1@l(r7) 32 | blr 33 | -------------------------------------------------------------------------------- /kernel/asm/FakeAIInterrupt.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | FakeAIInterrupt: 4 | 5 | lis r3, 0xC000 6 | lwz r4, 0x0054(r3) 7 | li r0, 0 8 | stw r0, 0x0054(r3) 9 | 10 | lis r3, 0xCC00 11 | lhz r0, 0x500A(r3) 12 | 13 | or r4, r0, r4 14 | 15 | blr 16 | -------------------------------------------------------------------------------- /kernel/asm/FakeEntryLoad.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | .set RESET_STATUS, 0xD3003420 4 | .set FLUSH_LEN, 0xD3003424 5 | .set FLUSH_ADDR, 0xD3003428 6 | 7 | FakeEntryLoad: 8 | lis r3, RESET_STATUS@h 9 | li r0, 0x4DEA 10 | stw r0, RESET_STATUS@l(r3) 11 | wait_loop: 12 | lwz r4, RESET_STATUS@l(r3) 13 | cmplw r4, r0 14 | beq wait_loop 15 | mtlr r4 16 | 17 | lwz r4, FLUSH_LEN@l(r3) 18 | mtctr r4 19 | 20 | lwz r4, FLUSH_ADDR@l(r3) 21 | InvalidateRange1: 22 | dcbi 0, r4 23 | icbi 0, r4 24 | addi r4, r4, 0x20 25 | bdnz InvalidateRange1 26 | 27 | li r4, 0x100 28 | mtctr r4 29 | lis r4, 0x8000 30 | ori r4, r4, 0x1000 31 | 32 | InvalidateRange2: 33 | dcbi 0, r4 34 | icbi 0, r4 35 | addi r4, r4, 0x20 36 | bdnz InvalidateRange2 37 | 38 | sync 39 | isync 40 | 41 | blr 42 | -------------------------------------------------------------------------------- /kernel/asm/FakeInterrupt.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | FakeInterrupt: 5 | lwz r31, 0x3000(r3) 6 | andi. r0, r31, 0x4000 #check if IPC IRQ 7 | rlwinm r31, r31, 0, 18, 31 #relevant irqs 8 | beq end #if bit 14=0 then no need to check 9 | 10 | lis r3, 0xCD80 11 | li r0, 0x22 12 | stw r0, 4(r3) 13 | lis r0, 0x4000 14 | stw r0, 0x30(r3) 15 | 16 | lis r3, INT_BASE@h 17 | lwz r0, RSW_INT@l(r3) 18 | rlwimi r31, r0, 0, 30, 30 #0x2 19 | 20 | lwz r0, DI_INT@l(r3) 21 | rlwimi r31, r0, 0, 29, 29 #0x4 22 | 23 | lwz r0, SI_INT@l(r3) 24 | rlwimi r31, r0, 0, 28, 28 #0x8 25 | 26 | lwz r0, EXI_INT@l(r3) 27 | rlwimi r31, r0, 0, 27, 27 #0x10 28 | 29 | lwz r0, HSP_INT@l(r3) 30 | rlwimi r31, r0, 0, 18, 18 #0x2000 31 | 32 | end: 33 | lis r3, 0xCC00 34 | blr 35 | -------------------------------------------------------------------------------- /kernel/asm/FakeInterrupt_DBG.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | FakeInterrupt_DBG: 5 | lwz r29, 0x3000(r3) 6 | andi. r0, r29, 0x4000 #check if IPC IRQ 7 | rlwinm r29, r29, 0, 18, 31 #relevant irqs 8 | beq end #if bit 14=0 then no need to check 9 | 10 | lis r3, 0xCD80 11 | li r0, 0x22 12 | stw r0, 4(r3) 13 | lis r0, 0x4000 14 | stw r0, 0x30(r3) 15 | 16 | lis r3, INT_BASE@h 17 | lwz r0, RSW_INT@l(r3) 18 | rlwimi r29, r0, 0, 30, 30 #0x2 19 | 20 | lwz r0, DI_INT@l(r3) 21 | rlwimi r29, r0, 0, 29, 29 #0x4 22 | 23 | lwz r0, SI_INT@l(r3) 24 | rlwimi r29, r0, 0, 28, 28 #0x8 25 | 26 | lwz r0, EXI_INT@l(r3) 27 | rlwimi r29, r0, 0, 27, 27 #0x10 28 | 29 | end: 30 | lis r3, 0xCC00 31 | blr 32 | -------------------------------------------------------------------------------- /kernel/asm/FakeInterrupt_Datel.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | FakeInterrupt: 5 | # could just use r9 and r28/r10 instead of backup/restore r3 and r31 6 | mr r9, r3 7 | mr r28, r31 8 | lis r3, IRQ_STATUS@h 9 | ori r3, r3,IRQ_STATUS@l 10 | lwz r31, 0x0000(r3) 11 | andi. r0, r31, 0x4000 #check if IPC IRQ 12 | rlwinm r31, r31, 0, 18, 15 #relevant irqs # Datel requires bit 15 high 13 | beq end #if bit 14=0 then no need to check 14 | 15 | lis r3, 0xCD80 16 | li r0, 0x22 17 | stw r0, 4(r3) 18 | lis r0, 0x4000 19 | stw r0, 0x30(r3) 20 | 21 | lis r3, INT_BASE@h 22 | lwz r0, RSW_INT@l(r3) 23 | rlwimi r31, r0, 0, 30, 30 #0x2 24 | 25 | lwz r0, DI_INT@l(r3) 26 | rlwimi r31, r0, 0, 29, 29 #0x4 27 | 28 | lwz r0, SI_INT@l(r3) 29 | rlwimi r31, r0, 0, 28, 28 #0x8 30 | 31 | lwz r0, EXI_INT@l(r3) 32 | rlwimi r31, r0, 0, 27, 27 #0x10 33 | 34 | end: 35 | mr r10, r31 36 | mr r3, r9 37 | mr r31, r28 38 | mr r28, r10 # Some versions use r28, others r10 39 | # lis r3, 0xCC00 40 | blr 41 | -------------------------------------------------------------------------------- /kernel/asm/FakeRSWLoad.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | OSGetResetButtonState: 5 | lis r5, INT_BASE@h 6 | lwz r6, RSW_INT@l(r5) 7 | cmpwi r6, 0 8 | beq end 9 | mr r0, r6 10 | 11 | end: 12 | rlwinm. r0, r0, 0, 15, 15 13 | blr 14 | -------------------------------------------------------------------------------- /kernel/asm/FakeRSWStore.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | __OSResetSWInterruptHandler: 5 | #original instruction 6 | stw r0, 0x3000(r3) 7 | 8 | lis r3, INT_BASE@h 9 | lwz r0, RSW_INT@l(r3) 10 | cmpwi r0, 0 11 | beq end 12 | #keep something in RSW_INT for OSGetResetButtonState 13 | lis r0, 0x2 14 | stw r0, RSW_INT@l(r3) 15 | 16 | end: 17 | blr 18 | -------------------------------------------------------------------------------- /kernel/asm/GCAMSendCommand.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | GCAMSendCommand: 4 | mflr r0 5 | stw r0, 4(%sp) 6 | stwu %sp, -8(%sp) 7 | 8 | lis r4, 0 #gets replaced 9 | addi r4, r4, 0 #gets replaced 10 | addi r6, r4, 0x80 11 | 12 | #flush DataIn 13 | clrrwi r3, r4, 5 14 | subf r5, r3, r4 15 | addi r5, r5, 0x80 #static data length 16 | addi r5, r5, 0x1F 17 | srwi r5, r5, 5 18 | mtctr r5 19 | 20 | DCFlushRange: 21 | dcbf 0, r3 22 | addi r3, r3, 0x20 23 | bdnz DCFlushRange 24 | sync 25 | 26 | lis r7, 0xD302 27 | lis r0, 0x7000 28 | 29 | stw r0, 0x6100(r7) 30 | stw r4, 0x6104(r7) 31 | stw r6, 0x6108(r7) 32 | 33 | li r0, 3 34 | stw r0, 0x6118(r7) 35 | 36 | ready_loop: 37 | lwz r0, 0x6118(r7) 38 | cmpwi r0, 3 39 | beq ready_loop 40 | 41 | #invalidate DataOut 42 | clrrwi r3, r6, 5 43 | subf r5, r3, r6 44 | addi r5, r5, 0x80 #static data length 45 | addi r5, r5, 0x1F 46 | srwi r5, r5, 5 47 | mtctr r5 48 | 49 | DCInvalidateRange: 50 | dcbi 0, r3 51 | addi r3, r3, 0x20 52 | bdnz DCInvalidateRange 53 | sync 54 | 55 | lis r3, 0 #gets replaced 56 | addi r3, r3, 0 #gets replaced 57 | 58 | mtctr r3 59 | li r3, 0 60 | li r4, 0 61 | bctrl 62 | 63 | li r3, 1 64 | 65 | lwz r0, 12(%sp) 66 | addi %sp, %sp, 8 67 | mtlr r0 68 | blr 69 | -------------------------------------------------------------------------------- /kernel/asm/GXInitTlutObj.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #r3=obj 4 | #r4=addr 5 | #r5=format 6 | #r6=entries 7 | 8 | GXInitTlutObj: 9 | slwi r0, r5, 10 10 | stw r0, 0(r3) 11 | lis r0, 0x6400 12 | rlwimi r0, r4, 27, 12, 31 #((addr>>5)&0xFFFFF) 13 | stw r0, 4(r3) 14 | sth r6, 8(r3) 15 | blr 16 | -------------------------------------------------------------------------------- /kernel/asm/GXLoadTlut.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | GXLoadTlut: 4 | lwz r0, 4(r30) 5 | rlwinm r0, r0, 0, 12, 7 6 | blr 7 | -------------------------------------------------------------------------------- /kernel/asm/HSPIntrruptHandler.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | HSPIntrruptHandler: 5 | stwu %sp, -0x14(%sp) 6 | mflr %r0 7 | stw %r0, 0xC(%sp) 8 | 9 | # get irq and ack 10 | lis 4, HSP_INT@h 11 | lwz 3, HSP_INT@l(4) 12 | li 0, 0 13 | stw 0, HSP_INT@l(4) 14 | # add queue number from irq and execute wakeup 15 | rlwinm 3, 3, 3, 22, 28 16 | addis 3, 3, SO_BASE_PPC@ha 17 | addi 3, 3, SO_BASE_PPC@l 18 | nop # bl OSWakeupThread 19 | 20 | lwz %r0, 0xC(%sp) 21 | addi %sp, %sp, 0x14 22 | mtlr %r0 23 | blr 24 | -------------------------------------------------------------------------------- /kernel/asm/IPClearConfigError.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | IPClearConfigError: 5 | lis 0, IPClearConfigErrorAddr@h 6 | ori 0, 0, IPClearConfigErrorAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/IPGetAddr.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | IPGetAddr: 5 | lis 0, IPGetAddrAddr@h 6 | ori 0, 0, IPGetAddrAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/IPGetConfigError.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | IPGetConfigError: 5 | lis 0, IPGetConfigErrorAddr@h 6 | ori 0, 0, IPGetConfigErrorAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/IPGetLinkState.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | IPGetLinkState: 5 | lis 0, IPGetLinkStateAddr@h 6 | ori 0, 0, IPGetLinkStateAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/IPGetMacAddr.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | IPGetMacAddr: 5 | lis 0, IPGetMacAddrAddr@h 6 | ori 0, 0, IPGetMacAddrAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/IPGetMtu.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | IPGetMtu: 5 | lis 0, IPGetMtuAddr@h 6 | ori 0, 0, IPGetMtuAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/IPGetNetmask.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | IPGetNetmask: 5 | lis 0, IPGetNetmaskAddr@h 6 | ori 0, 0, IPGetNetmaskAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/IPSetConfigError.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | IPSetConfigError: 5 | lis 0, IPSetConfigErrorAddr@h 6 | ori 0, 0, IPSetConfigErrorAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/KeyboardRead.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | KeyboardRead: 5 | #to stub instead of arm 6 | lis r0, KeyboardStub@h 7 | ori r0, r0, KeyboardStub@l 8 | mtctr r0 9 | bctr 10 | -------------------------------------------------------------------------------- /kernel/asm/MajoraLoadRegs.S: -------------------------------------------------------------------------------- 1 | /* 2 | MajoraLoadRegs.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | .include "constants.inc" 21 | 22 | .set tmp, 28 23 | .set buf, 27 24 | .set loc, 26 25 | .set glob, 25 26 | .set cmpstrm, 5 #unused 27 | 28 | #little ugly to save instruction 29 | MajoraLoadRegs: 30 | beq cmpstrm,end 31 | stw loc, AI_ADP_LOC@l(glob) 32 | end: 33 | lwz r27, 0xC(r1) 34 | lwz r26, 0x8(r1) 35 | lwz r25, 0x4(r1) 36 | addi r1, r1, 0x20 37 | blr 38 | -------------------------------------------------------------------------------- /kernel/asm/MajoraSaveRegs.S: -------------------------------------------------------------------------------- 1 | /* 2 | MajoraSaveRegs.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | .include "constants.inc" 21 | 22 | .set tmp, 28 23 | .set buf, 27 24 | .set loc, 26 25 | .set glob, 25 26 | .set cmpstrm, 5 #unused 27 | 28 | #they left the stack room but didnt use it, good for us 29 | MajoraSaveRegs: 30 | stw glob, 0x10(r1) 31 | stw buf, 0xC(r1) 32 | stw loc, 0x8(r1) 33 | stw tmp, 0x4(r1) 34 | lis glob, STREAMING@h 35 | lwz tmp, STREAMING@l(glob) 36 | cmpwi cmpstrm,tmp, 0 37 | beq cmpstrm,end 38 | lwz loc, AI_ADP_LOC@l(glob) 39 | end: 40 | nop #b ori 41 | -------------------------------------------------------------------------------- /kernel/asm/Makefile: -------------------------------------------------------------------------------- 1 | #PREFIX = powerpc-gekko- 2 | PREFIX = $(DEVKITPPC)/bin/powerpc-eabi- 3 | #PREFIX = /home/megazig/Wii/bootmii-utils/bin/powerpc-elf- 4 | 5 | AR = $(PREFIX)ar 6 | AS = $(PREFIX)as 7 | CC = $(PREFIX)gcc 8 | CXX = $(PREFIX)g++ 9 | LD = $(PREFIX)ld 10 | OBJCOPY = $(PREFIX)objcopy 11 | RANLIB = $(PREFIX)ranlib 12 | STRIP = $(PREFIX)strip 13 | 14 | ifeq ($(OS),Windows_NT) 15 | BIN2H = ../bin2h/bin2h.exe 16 | else 17 | BIN2H = ../bin2h/bin2h 18 | endif 19 | 20 | SFILES := $(wildcard *.S) 21 | DFILES := $(SFILES:.S=.d) 22 | ELFFILES := $(SFILES:.S=.elf) 23 | BINFILES := $(ELFFILES:.elf=.bin) 24 | HFILES := $(BINFILES:.bin=.h) 25 | 26 | all: $(HFILES) 27 | 28 | -include $(DFILES) 29 | .PRECIOUS: %.elf %.bin 30 | 31 | %.elf: %.S 32 | @echo " ASSEMBLE $<" 33 | @$(AS) $< -mregnames -MD $(@:.elf=.d) -o $@ 34 | 35 | %.bin: %.elf 36 | @echo " STRIP $<" 37 | @$(STRIP) $< -O binary -S -s -o $@ 38 | 39 | %.h: %.bin 40 | @echo " BIN2H $<" 41 | @$(BIN2H) $< 42 | 43 | clean: 44 | @echo clean ... 45 | @rm -fr *.d *.h *.bin *.elf 46 | -------------------------------------------------------------------------------- /kernel/asm/OSExceptionInit.S: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | OSExceptionInit: 4 | #original instruction 5 | nop 6 | #r3 is the dest of this handler 7 | cmpwi r3, 0xF00 8 | #smaller or equal is actually ok 9 | ble end 10 | #everything above though... 11 | li r3, 0xF00 #grab low mem! 12 | end: 13 | blr 14 | -------------------------------------------------------------------------------- /kernel/asm/OSReportDM.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | .set OSReport, 0xC0001860 4 | 5 | OSReportDM: 6 | stwu %sp, -0x20(%sp) 7 | mflr r0 8 | stw r0, 0xC(%sp) 9 | stw r9, 0x10(%sp) 10 | lis r9, OSReport@h 11 | 12 | stw r4, 0x1864(r9) 13 | stw r5, 0x1868(r9) 14 | stw r6, 0x186C(r9) 15 | stw r7, 0x1870(r9) 16 | stw r8, 0x1874(r9) 17 | 18 | stw r3, 0x1860(r9) 19 | repeatcheck: 20 | lwz r0, 0x1860(r9) 21 | cmpw r0, r3 22 | beq repeatcheck 23 | 24 | lwz r0, 0xC(%sp) 25 | lwz r9, 0x10(%sp) 26 | addi %sp, %sp, 0x20 27 | mtlr r0 28 | blr 29 | -------------------------------------------------------------------------------- /kernel/asm/PADControlAllMotors.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADControlAllMotors: 5 | lis r4, PadRumble@h 6 | ori r4, r4, PadRumble@l #chan0 base 7 | 8 | li r5, 3 9 | 10 | repeat: 11 | slwi r6, r5, 2 12 | lwzx r0, r6, r3 13 | stwx r0, r6, r4 14 | cmpwi r5, 0 15 | beq exit 16 | subi r5, r5, 1 17 | b repeat 18 | 19 | exit: 20 | blr 21 | -------------------------------------------------------------------------------- /kernel/asm/PADControlMotor.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADControlMotor: 5 | cmpwi r3, 0 6 | blt exit 7 | cmpwi r3, 3 8 | bgt exit 9 | 10 | lis r0, PadRumble@h 11 | ori r0, r0, PadRumble@l #chan0 base 12 | slwi r3, r3, 2 13 | stwx r4, r3, r0 14 | 15 | exit: 16 | blr 17 | -------------------------------------------------------------------------------- /kernel/asm/PADControlMotorGP.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADControlMotorGP: 5 | #original instruction 6 | lbz r4, 0x2F(r31) 7 | #load control motor base into r3 8 | lis r3, PadRumble@h 9 | ori r3, r3, PadRumble@l 10 | #start by checking if rumble was active 11 | lbz r5, 0(r3) 12 | cmpwi r5, 0 13 | beq checkRumble 14 | #was active, extend rumble 15 | subi r5, r5, 1 16 | stb r5, 0(r3) 17 | b rumbleOn 18 | checkRumble: 19 | #was not active so check now 20 | li r0, 0 21 | cmpwi r4, 0 22 | beq saveRumble 23 | #did not rumble before, set up 24 | li r5, 15 25 | stb r5, 0(r3) 26 | rumbleOn: 27 | li r0, 1 28 | saveRumble: 29 | stb r0, 3(r3) 30 | blr 31 | -------------------------------------------------------------------------------- /kernel/asm/PADIsBarrel.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADIsBarrel: 5 | cmpwi r3, 0 6 | blt invalid 7 | cmpwi r3, 3 8 | bgt invalid 9 | 10 | lis r0, 0xD300 11 | ori r0, r0, 0x3130 #chan0 base 12 | slwi r3, r3, 2 13 | lwzx r3, r3, r0 14 | blr 15 | 16 | invalid: 17 | li r3, 0 18 | blr 19 | -------------------------------------------------------------------------------- /kernel/asm/PADRead.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADRead: 5 | stwu %sp, -0x20(%sp) 6 | mflr r0 7 | stw r0, 0xC(%sp) 8 | stw r31, 0x10(%sp) 9 | mr r31, r3 10 | 11 | #to stub instead of arm 12 | lis r3, PadStub@h 13 | ori r3, r3, PadStub@l 14 | mtctr r3 15 | bctrl 16 | 17 | lis r5, PadBuff@h 18 | ori r5, r5, PadBuff@l 19 | 20 | #original code 21 | li r4, 0x30 22 | 23 | memcpy: 24 | lwz r6, 0(r5) 25 | lwz r7, 4(r5) 26 | lwz r8, 8(r5) 27 | addi r5, r5, 0xC 28 | stw r6, 0(r31) 29 | stw r7, 4(r31) 30 | stw r8, 8(r31) 31 | addi r31, r31, 0xC 32 | subi r4, r4, 0xC 33 | cmpwi r4, 0 34 | bne memcpy 35 | 36 | lwz r0, 0xC(%sp) 37 | lwz r31, 0x10(%sp) 38 | addi %sp, %sp, 0x20 39 | mtlr r0 40 | blr 41 | -------------------------------------------------------------------------------- /kernel/asm/PADReadF.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADReadF: 5 | #only update player 1 6 | cmplwi r28, 0 7 | bne end 8 | 9 | stwu %sp, -0x20(%sp) 10 | mflr r0 11 | stw r0, 0xC(%sp) 12 | 13 | #to stub instead of arm 14 | lis r3, PadStub@h 15 | ori r3, r3, PadStub@l 16 | mtctr r3 17 | bctrl 18 | 19 | lis r3, PadBuff@h 20 | ori r3, r3, PadBuff@l 21 | #store player data for ARM JVSIO.c 22 | dcbf 0, r3 23 | 24 | lwz r0, 0xC(%sp) 25 | mtlr r0 26 | addi %sp, %sp, 0x20 27 | 28 | end: 29 | #original instruction 30 | mr r3, r31 31 | blr 32 | -------------------------------------------------------------------------------- /kernel/asm/PADReadGP.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADReadGP: 5 | #original instruction 6 | mr r31, r3 7 | 8 | stwu %sp, -0x20(%sp) 9 | mflr r0 10 | stw r0, 0xC(%sp) 11 | 12 | #to stub instead of arm 13 | lis r3, PadStub@h 14 | ori r3, r3, PadStub@l 15 | mtctr r3 16 | bctrl 17 | 18 | lis r3, PadBuff@h 19 | ori r3, r3, PadBuff@l 20 | #store player data for ARM JVSIO.c 21 | dcbf 0, r3 22 | 23 | lwz r0, 0xC(%sp) 24 | mtlr r0 25 | 26 | addi %sp, %sp, 0x20 27 | blr 28 | -------------------------------------------------------------------------------- /kernel/asm/PADReadVS.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADReadVS: 5 | #original instruction 6 | mr r28, r3 7 | 8 | stwu %sp, -0x20(%sp) 9 | mflr r0 10 | stw r0, 0xC(%sp) 11 | 12 | #to stub instead of arm 13 | lis r3, PadStub@h 14 | ori r3, r3, PadStub@l 15 | mtctr r3 16 | bctrl 17 | 18 | lis r3, PadBuff@h 19 | ori r3, r3, PadBuff@l 20 | #store player data for ARM JVSIO.c 21 | dcbf 0, r3 22 | 23 | lwz r0, 0xC(%sp) 24 | mtlr r0 25 | addi %sp, %sp, 0x20 26 | 27 | blr 28 | -------------------------------------------------------------------------------- /kernel/asm/PADReadVS3.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | PADReadVS3: 5 | #original instruction 6 | mr r27, r3 7 | 8 | stwu %sp, -0x20(%sp) 9 | mflr r0 10 | stw r0, 0xC(%sp) 11 | 12 | #to stub instead of arm 13 | lis r3, PadStub@h 14 | ori r3, r3, PadStub@l 15 | mtctr r3 16 | bctrl 17 | 18 | lis r3, PadBuff@h 19 | ori r3, r3, PadBuff@l 20 | #store player data for ARM JVSIO.c 21 | dcbf 0, r3 22 | 23 | lwz r0, 0xC(%sp) 24 | mtlr r0 25 | addi %sp, %sp, 0x20 26 | 27 | blr 28 | -------------------------------------------------------------------------------- /kernel/asm/ReadROM.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | .set FontBuf, 0x93100000 4 | .set IPL_ROM_FONT_SJIS, 0x1AFF00 5 | .set IPL_ROM_FONT_ANSI, 0x1FCF00 6 | .set IPL_ROM_END_OFFSET, 0x200000 7 | 8 | #r3=Dest 9 | #r4=Size 10 | #r5=Source 11 | 12 | ReadROM: 13 | lis r0, IPL_ROM_END_OFFSET@h 14 | ori r0, r0, IPL_ROM_END_OFFSET@l 15 | cmpw r5, r0 16 | bge exit 17 | lis r0, IPL_ROM_FONT_SJIS@h 18 | ori r0, r0, IPL_ROM_FONT_SJIS@l 19 | cmpw r5, r0 20 | blt exit 21 | 22 | sub r5, r5, r0 23 | 24 | lis r6, FontBuf@h 25 | ori r6, r6, FontBuf@l 26 | add r6, r6, r5 27 | 28 | srwi r0, r4, 5 29 | mtctr r0 30 | mr r7, r6 31 | 32 | DCInvalidateRange: 33 | dcbi 0, r7 34 | addi r7, r7, 0x20 35 | bdnz DCInvalidateRange 36 | sync 37 | 38 | memcpy32prep: 39 | li r7, 0 40 | srwi r0, r4, 2 41 | mtctr r0 42 | memcpy32: 43 | lwzx r0, r6, r7 44 | stwx r0, r3, r7 45 | addi r7, r7, 4 46 | bdnz memcpy32 47 | 48 | exit: 49 | blr 50 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsAX_RVC.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsAX_RVC.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set AX_BACKUP, 0xD3003500 22 | .set AX_DEST, 0x803CF6F0 23 | 24 | RestoreSettingsAX: 25 | lis r3, AX_BACKUP@h 26 | ori r3, r3, AX_BACKUP@l 27 | lis r4, AX_DEST@h 28 | ori r4, r4, AX_DEST@l 29 | li r5, 0x2A 30 | memcpy: 31 | subic. r5, r5, 1 32 | lbzx r0, r3, r5 33 | stbx r0, r4, r5 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsAX_RVD.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsAX_RVD.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set AX_BACKUP, 0xD3003500 22 | .set AX_DEST, 0x803CFBD0 23 | 24 | RestoreSettingsAX: 25 | lis r3, AX_BACKUP@h 26 | ori r3, r3, AX_BACKUP@l 27 | lis r4, AX_DEST@h 28 | ori r4, r4, AX_DEST@l 29 | li r5, 0x2A 30 | memcpy: 31 | subic. r5, r5, 1 32 | lbzx r0, r3, r5 33 | stbx r0, r4, r5 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsAX_RVE.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsAX_RVE.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set AX_BACKUP, 0xD3003500 22 | .set AX_DEST, 0x803D0150 23 | 24 | RestoreSettingsAX: 25 | lis r3, AX_BACKUP@h 26 | ori r3, r3, AX_BACKUP@l 27 | lis r4, AX_DEST@h 28 | ori r4, r4, AX_DEST@l 29 | li r5, 0x2A 30 | memcpy: 31 | subic. r5, r5, 1 32 | lbzx r0, r3, r5 33 | stbx r0, r4, r5 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsVS3V02.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsVS3V02.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set VS3_BACKUP, 0xD3003500 22 | 23 | RestoreSettingsVS: 24 | lis r3, VS3_BACKUP@h 25 | ori r3, r3, VS3_BACKUP@l 26 | lwz r4, -0xB1C(r13) 27 | lwz r5, -0x1408(r13) 28 | li r6, 0x12 29 | memcpy: 30 | subic. r6, r6, 1 31 | lbzx r0, r3, r6 32 | stbx r0, r4, r6 33 | stbx r0, r5, r6 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsVS4EXP.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsVS4EXP.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set VS4_BACKUP, 0xD3003500 22 | 23 | RestoreSettingsVS: 24 | lis r3, VS4_BACKUP@h 25 | ori r3, r3, VS4_BACKUP@l 26 | lwz r4, -0x2D44(r13) 27 | lwz r5, -0x2CA8(r13) 28 | li r6, 0x2B 29 | memcpy: 30 | subic. r6, r6, 1 31 | lbzx r0, r3, r6 32 | stbx r0, r4, r6 33 | stbx r0, r5, r6 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsVS4JAP.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsVS4JAP.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set VS4_BACKUP, 0xD3003500 22 | 23 | RestoreSettingsVS: 24 | lis r3, VS4_BACKUP@h 25 | ori r3, r3, VS4_BACKUP@l 26 | lwz r4, -0x14C4(r13) 27 | lwz r5, -0x1428(r13) 28 | li r6, 0x2B 29 | memcpy: 30 | subic. r6, r6, 1 31 | lbzx r0, r3, r6 32 | stbx r0, r4, r6 33 | stbx r0, r5, r6 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsVS4V06EXP.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsVS4V06EXP.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set VS4_BACKUP, 0xD3003500 22 | 23 | RestoreSettingsVS: 24 | lis r3, VS4_BACKUP@h 25 | ori r3, r3, VS4_BACKUP@l 26 | lwz r4, -0xEE4(r13) 27 | lwz r5, -0xE40(r13) 28 | li r6, 0x2B 29 | memcpy: 30 | subic. r6, r6, 1 31 | lbzx r0, r3, r6 32 | stbx r0, r4, r6 33 | stbx r0, r5, r6 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsVS4V06JAP.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsVS4V06JAP.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set VS4_BACKUP, 0xD3003500 22 | 23 | RestoreSettingsVS: 24 | lis r3, VS4_BACKUP@h 25 | ori r3, r3, VS4_BACKUP@l 26 | lwz r4, -0xCDC(r13) 27 | lwz r5, -0xC38(r13) 28 | li r6, 0x2E 29 | memcpy: 30 | subic. r6, r6, 1 31 | lbzx r0, r3, r6 32 | stbx r0, r4, r6 33 | stbx r0, r5, r6 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsYAKRVB.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsYAKRVB.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set YAK_BACKUP, (0xD3003500+0xE8) 22 | .set YAK_DEST, (0x803D3D0C+0xE8) 23 | 24 | RestoreSettingsYAKRVB: 25 | lis r3, YAK_BACKUP@h 26 | ori r3, r3, YAK_BACKUP@l 27 | lis r4, YAK_DEST@h 28 | ori r4, r4, YAK_DEST@l 29 | li r5, (0xF5-0xE8) 30 | memcpy: 31 | subic. r5, r5, 1 32 | lbzx r0, r3, r5 33 | stbx r0, r4, r5 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/RestoreSettingsYAKRVC.S: -------------------------------------------------------------------------------- 1 | /* 2 | RestoreSettingsYAKRVB.S for Nintendont (Kernel) 3 | 4 | Copyright (C) 2015 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include 20 | 21 | .set YAK_BACKUP, (0xD3003500+0xE8) 22 | .set YAK_DEST, (0x803D67AC+0xE8) 23 | 24 | RestoreSettingsYAKRVB: 25 | lis r3, YAK_BACKUP@h 26 | ori r3, r3, YAK_BACKUP@l 27 | lis r4, YAK_DEST@h 28 | ori r4, r4, YAK_DEST@l 29 | li r5, (0x100-0xE8) 30 | memcpy: 31 | subic. r5, r5, 1 32 | lbzx r0, r3, r5 33 | stbx r0, r4, r5 34 | bne memcpy 35 | blr 36 | -------------------------------------------------------------------------------- /kernel/asm/Return0.S: -------------------------------------------------------------------------------- 1 | 2 | Return0: 3 | li 3,0 4 | blr 5 | -------------------------------------------------------------------------------- /kernel/asm/Return1.S: -------------------------------------------------------------------------------- 1 | 2 | Return1: 3 | li 3,1 4 | blr 5 | -------------------------------------------------------------------------------- /kernel/asm/ReturnMinus1.S: -------------------------------------------------------------------------------- 1 | 2 | ReturnMinus1: 3 | li 3,-1 4 | blr 5 | -------------------------------------------------------------------------------- /kernel/asm/SIGetType.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | .set SI_GC_CONTROLLER, 0x09000000 4 | .set SI_ERROR_NO_RESPONSE, 0x08 5 | .set PAD_USED_BASE, 0x93003020 6 | 7 | # 8 | # 9 | # r3 channel 10 | 11 | SIGetType: 12 | lis r4, PAD_USED_BASE@h 13 | ori r4, r4, PAD_USED_BASE@l 14 | 15 | DCInvalidateRange: 16 | dcbi 0, r4 17 | sync 18 | 19 | lwz r0, 4(r4) 20 | li r4, 1 21 | slw r4, r4, r3 22 | and r4, r0, r4 23 | cmpwi r4, 0 24 | beq NoPad 25 | 26 | lis r3, SI_GC_CONTROLLER@h 27 | blr 28 | 29 | NoPad: 30 | li r3, SI_ERROR_NO_RESPONSE@l 31 | blr 32 | -------------------------------------------------------------------------------- /kernel/asm/SIInitStore.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | .set SI_INITED, 0x93003060 4 | 5 | SIInitStore: 6 | lis r5, SI_INITED@h 7 | li r4, 1 8 | stwu r4, SI_INITED@l(r5) 9 | li r4, 0 10 | dcbf r4, r5 11 | sync 12 | blr 13 | -------------------------------------------------------------------------------- /kernel/asm/SIIntrruptHandler.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SIIntrruptHandler: 5 | #original instruction 6 | stw r0, 4(%sp) 7 | 8 | li r0, 0 9 | lis r8, INT_BASE@h 10 | stw r0, SI_INT@l(r8) 11 | 12 | blr 13 | -------------------------------------------------------------------------------- /kernel/asm/SOAccept.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOAccept: 5 | lis 0, SOAcceptAddr@h 6 | ori 0, 0, SOAcceptAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOBind.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOBind: 5 | lis 0, SOBindAddr@h 6 | ori 0, 0, SOBindAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOCleanup.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOCleanup: 5 | lis 0, SOCleanupAddr@h 6 | ori 0, 0, SOCleanupAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOClose.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOClose: 5 | lis 0, SOCloseAddr@h 6 | ori 0, 0, SOCloseAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOConnect.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOConnect: 5 | lis 0, SOConnectAddr@h 6 | ori 0, 0, SOConnectAddr@l 7 | mtctr 0 8 | bctr -------------------------------------------------------------------------------- /kernel/asm/SOFcntl.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOFcntl: 5 | lis 0, SOFcntlAddr@h 6 | ori 0, 0, SOFcntlAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOInit.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOInit: 5 | lis 0, SOInitAddr@h 6 | ori 0, 0, SOInitAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOListen.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOListen: 5 | lis 0, SOListenAddr@h 6 | ori 0, 0, SOListenAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOPoll.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOPoll: 5 | lis 0, SOPollAddr@h 6 | ori 0, 0, SOPollAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SORecvFrom.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SORecvFrom: 5 | lis 0, SORecvFromAddr@h 6 | ori 0, 0, SORecvFromAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOSendTo.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOSendTo: 5 | lis 0, SOSendToAddr@h 6 | ori 0, 0, SOSendToAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOSetSockOpt.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOSetSockOpt: 5 | lis 0, SOSetSockOptAddr@h 6 | ori 0, 0, SOSetSockOptAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOShutdown.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOShutdown: 5 | lis 0, SOShutdownAddr@h 6 | ori 0, 0, SOShutdownAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOSocket.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOSocket: 5 | lis 0, SOSocketAddr@h 6 | ori 0, 0, SOSocketAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SOStartup.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | SOStartup: 5 | lis 0, SOStartupAddr@h 6 | ori 0, 0, SOStartupAddr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/SonicRidersCopy.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #r5=size to copy 4 | 5 | SonicRidersCopy: 6 | #original instruction 7 | mr r31, r7 8 | #7 works but going safe 9 | slwi r5, r5, 8 10 | waitLoop: 11 | subi r5, r5, 1 12 | cmplwi r5, 0 13 | bne waitLoop 14 | blr 15 | -------------------------------------------------------------------------------- /kernel/asm/SwitcherPrs.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | .set PRS_DOL, 0xD31C0000 4 | .set PRS_EXTRACT, 0xD31C0020 5 | 6 | SwitcherPrs: 7 | stwu %sp, -0x20(%sp) 8 | mflr r0 9 | stw r0, 8(%sp) 10 | stw r31, 0x10(%sp) 11 | 12 | lis r31, PRS_EXTRACT@h 13 | lwz r0, PRS_EXTRACT@l(r31) #offset saved from Patch.c 14 | mtlr r0 15 | 16 | blrl #extracts switcher 17 | 18 | lis r31, PRS_DOL@h 19 | lwz r0, PRS_DOL@l(r31) #FakeEntryLoad 20 | stw r0, 0xE0(r28) #modify dol entry 21 | 22 | lwz r31, 0x10(%sp) 23 | lwz r0, 8(%sp) 24 | mtlr r0 25 | addi %sp, %sp, 0x20 26 | 27 | blr 28 | -------------------------------------------------------------------------------- /kernel/asm/TCIntrruptHandler.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | TCIntrruptHandler: 5 | #original instruction 6 | stw r0, 4(%sp) 7 | 8 | li r0, 0 9 | lis r8, INT_BASE@h 10 | stw r0, EXI_INT@l(r8) 11 | 12 | blr 13 | -------------------------------------------------------------------------------- /kernel/asm/__CARDClearStatus.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #in 4 | # r3 channel 5 | 6 | #out 7 | # r3 res 8 | 9 | __CARDClearStatus: 10 | li r3, 0 11 | blr 12 | -------------------------------------------------------------------------------- /kernel/asm/__CARDReadStatus.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #in 4 | # r3 channel 5 | # r4 Status buffer (byte) 6 | 7 | #out 8 | # r3 res 9 | 10 | __CARDReadStatus: 11 | 12 | li r3, 0x41 # unlock | ready 13 | stb r3, 0x0(r4) 14 | 15 | li r3, 0 16 | 17 | blr 18 | -------------------------------------------------------------------------------- /kernel/asm/__DVDInterruptHandler.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | __DVDInterruptHandler: 5 | li r0, 0 6 | lis r3, INT_BASE@h 7 | stw r0, DI_INT@l(r3) 8 | 9 | lwz r0, DI_INV_LEN@l(r3) 10 | cmplwi r0, 0 11 | beq end 12 | 13 | InvalidatePrep: 14 | srwi r0, r0, 5 15 | mtctr r0 16 | li r0, 0 17 | stw r0, DI_INV_LEN@l(r3) 18 | 19 | lwz r3, DI_INV_ADR@l(r3) 20 | InvalidateRange: 21 | dcbi 0, r3 22 | icbi 0, r3 23 | addi r3, r3, 0x20 24 | bdnz InvalidateRange 25 | 26 | end: 27 | #original instructions 28 | nop 29 | lis r3, DI_BASE@h 30 | 31 | blr 32 | -------------------------------------------------------------------------------- /kernel/asm/__GXSetVAT.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __GXSetVAT: 4 | lwz r5, 0(r13) #GXData 5 | li r3, 8 6 | li r4, 0 7 | lbz r6, 0x4F2(r5) 8 | mr r7, r5 #Backup GXData 9 | lis r8, 0xCC01 #GX Register 10 | 11 | loop: 12 | clrlwi. r0, r6, 31 13 | beq checkNext 14 | 15 | stb r3, -0x8000(r8) 16 | ori r0, r4, 0x70 17 | stb r0, -0x8000(r8) 18 | lwz r0, 0x1C(r5) 19 | stw r0, -0x8000(r8) 20 | 21 | stb r3, -0x8000(r8) 22 | ori r0, r4, 0x80 23 | stb r0, -0x8000(r8) 24 | lwz r0, 0x3C(r5) 25 | stw r0, -0x8000(r8) 26 | 27 | stb r3, -0x8000(r8) 28 | ori r0, r4, 0x90 29 | stb r0, -0x8000(r8) 30 | lwz r0, 0x5C(r5) 31 | stw r0, -0x8000(r8) 32 | 33 | checkNext: 34 | addi r4, r4, 1 35 | addi r5, r5, 4 36 | srwi. r6, r6, 1 37 | bne loop 38 | 39 | li r0, 0 40 | stb r0, -0x8000(r8) 41 | stb r0, 0x4F2(r7) 42 | blr 43 | -------------------------------------------------------------------------------- /kernel/asm/avetcp_init.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | avetcp_init: 5 | lis 0, avetcp_init_Addr@h 6 | ori 0, 0, avetcp_init_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/avetcp_term.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | avetcp_term: 5 | lis 0, avetcp_term_Addr@h 6 | ori 0, 0, avetcp_term_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/codehandler_stub.S: -------------------------------------------------------------------------------- 1 | 2 | .set codehandler_bin, 0x800010A0 3 | 4 | codehandler_stub: 5 | #disable interrupts 6 | mfmsr 4 7 | rlwinm 0,4,0,17,15 8 | mtmsr 0 9 | #save lr on stack 10 | mflr 0 11 | stw 0,4(1) 12 | stwu 1,-0x10(1) 13 | #save interrupt state 14 | stw 4,0xC(1) 15 | #load up codehandler 16 | lis 4, codehandler_bin@h 17 | ori 4,4, codehandler_bin@l 18 | mtctr 4 19 | bctrl 20 | #get interrupts back 21 | lwz 4,0xC(1) 22 | #get lr back 23 | addi 1,1,0x10 24 | lwz 0,4(1) 25 | mtlr 0 26 | #restore interrupts 27 | mtmsr 4 28 | blr 29 | -------------------------------------------------------------------------------- /kernel/asm/dns_clear_server.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | dns_clear_server: 5 | lis 0, dns_clear_server_Addr@h 6 | ori 0, 0, dns_clear_server_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/dns_close.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | dns_close: 5 | lis 0, dns_close_Addr@h 6 | ori 0, 0, dns_close_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/dns_get_addr.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | dns_get_addr: 5 | lis 0, dns_get_addr_Addr@h 6 | ori 0, 0, dns_get_addr_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/dns_open_addr.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | dns_open_addr: 5 | lis 0, dns_open_addr_Addr@h 6 | ori 0, 0, dns_open_addr_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/dns_set_server.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | dns_set_server: 5 | lis 0, dns_set_server_Addr@h 6 | ori 0, 0, dns_set_server_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/patch_fwrite_GC.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | # - only works for patch_fwrite_A-C 4 | #in 5 | # r3 address 6 | # r4 size 7 | # r5 length 8 | 9 | #out - patch_fwrite_A-C 10 | # r3 length written 11 | 12 | patch_fwrite_GC: 13 | mullw. r4, r5, r4 14 | ble end 15 | lis r7, 0xCD00 16 | lis r10, 0xCD00 17 | lis r11, 0xCD00 18 | ori r7, r7, 0x6418 19 | ori r10, r10, 0x6428 20 | ori r11, r11, 0x6424 21 | li r6, 0 22 | 23 | outerloop: 24 | lbzx r0, r6, r3 25 | rlwinm r0, r0, 20,0,11 26 | oris r8, r0, 0xB000 27 | 28 | loop: 29 | li r0, 0xD0 30 | stw r0, 0(r7) 31 | eieio 32 | stw r8, 0(r10) 33 | eieio 34 | li r0, 0x19 35 | stw r0, 0(r11) 36 | eieio 37 | 38 | NotDone: 39 | lwz r0, 0(r11) 40 | sync 41 | andi. r9, r0, 1 42 | bne NotDone 43 | 44 | lwz r0, 0(r10) 45 | sync 46 | li r9, 0 47 | stw r9, 0(r7) 48 | eieio 49 | andis. r9, r0, 0x400 50 | beq loop 51 | 52 | addi r6, r6, 1 53 | cmpw cr7, r6, r4 54 | bne cr7, outerloop 55 | 56 | end: 57 | mr r3, r5 58 | blr 59 | -------------------------------------------------------------------------------- /kernel/asm/patch_fwrite_Log.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | .set fwriteBuff, 0x93160000 4 | 5 | #in - patch_fwrite_A-C 6 | # r3 address 7 | # r4 size 8 | # r5 length 9 | #in - patch_fwrite_D 10 | # r3 address 11 | # r4 length 12 | 13 | #out - patch_fwrite_A-C 14 | # r3 length written 15 | #out - patch_fwrite_D 16 | # r3 ret =0 17 | 18 | patch_fwrite_Log: 19 | 20 | # mr. r5, r4 # - use instead for patch_fwrite_D 21 | mullw. r4, r5, r4 22 | ble end 23 | lis r7, fwriteBuff@h 24 | ori r7, r7, fwriteBuff@l 25 | 26 | lwz r6, 4(r7) 27 | cmpwi r6, 0 28 | bne end 29 | 30 | #DCFlushRange 31 | srwi r6, r4, 5 32 | addi r6, r6, 2 33 | mtctr r6 34 | mr r6, r3 35 | rlwinm r6, r6, 0,0,26 36 | 37 | DCFlushRange: 38 | dcbf 0, r6 39 | addi r6, r6, 0x20 40 | bdnz DCFlushRange 41 | 42 | stw r3, 0(r7) 43 | stw r4, 4(r7) 44 | 45 | dcbf 0, r7 46 | sync 47 | ready_loop: 48 | lwz r6, 4(r7) 49 | dcbi 0, r7 50 | sync 51 | cmpw r4, r6 52 | beq ready_loop 53 | 54 | end: 55 | # li r3, 0 #- use instead for patch_fwrite_D 56 | mr r3, r5 57 | blr 58 | -------------------------------------------------------------------------------- /kernel/asm/tcp_abort.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_abort: 5 | lis 0, tcp_abort_Addr@h 6 | ori 0, 0, tcp_abort_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_accept.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_accept: 5 | lis 0, tcp_accept_Addr@h 6 | ori 0, 0, tcp_accept_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_bind.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_bind: 5 | lis 0, tcp_bind_Addr@h 6 | ori 0, 0, tcp_bind_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_connect.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_connect: 5 | lis 0, tcp_connect_Addr@h 6 | ori 0, 0, tcp_connect_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_create.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_create: 5 | lis 0, tcp_create_Addr@h 6 | ori 0, 0, tcp_create_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_delete.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_delete: 5 | lis 0, tcp_delete_Addr@h 6 | ori 0, 0, tcp_delete_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_getaddr.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_getaddr: 5 | lis 0, tcp_getaddr_Addr@h 6 | ori 0, 0, tcp_getaddr_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_listen.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_listen: 5 | lis 0, tcp_listen_Addr@h 6 | ori 0, 0, tcp_listen_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_receive.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_receive: 5 | lis 0, tcp_receive_Addr@h 6 | ori 0, 0, tcp_receive_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_send.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_send: 5 | lis 0, tcp_send_Addr@h 6 | ori 0, 0, tcp_send_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/asm/tcp_stat.S: -------------------------------------------------------------------------------- 1 | #include 2 | .include "constants.inc" 3 | 4 | tcp_stat: 5 | lis 0, tcp_stat_Addr@h 6 | ori 0, 0, tcp_stat_Addr@l 7 | mtctr 0 8 | bctr 9 | -------------------------------------------------------------------------------- /kernel/be/README: -------------------------------------------------------------------------------- 1 | libc.a and libgcc.a are from devkitARM r42, the latest devkitARM r43 does not include big endian versions anymore. -------------------------------------------------------------------------------- /kernel/be/libc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/kernel/be/libc.a -------------------------------------------------------------------------------- /kernel/be/libgcc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/kernel/be/libgcc.a -------------------------------------------------------------------------------- /kernel/bin2h/bin2h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/kernel/bin2h/bin2h -------------------------------------------------------------------------------- /kernel/bin2h/bin2h.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/kernel/bin2h/bin2h.exe -------------------------------------------------------------------------------- /kernel/bin2h/make.cmd: -------------------------------------------------------------------------------- 1 | gcc main.c -s -Os -static -o bin2h.exe 2 | pause -------------------------------------------------------------------------------- /kernel/bin2h/make.sh: -------------------------------------------------------------------------------- 1 | gcc main.c -m32 -s -Os -static -o bin2h 2 | chmod a+x bin2h 3 | -------------------------------------------------------------------------------- /kernel/bmp.h: -------------------------------------------------------------------------------- 1 | /* Note: the magic number has been removed from the bmp_header structure 2 | since it causes alignment problems 3 | struct bmpfile_magic should be written/read first 4 | followed by the 5 | struct bmpfile_header 6 | [this avoids compiler-specific alignment pragmas etc.] 7 | */ 8 | 9 | #ifndef __BMP_FILE_H__ 10 | #define __BMP_FILE_H__ 11 | 12 | typedef struct { 13 | unsigned char magic[2]; 14 | } bmpfile_magic; 15 | 16 | typedef struct { 17 | unsigned int filesz; 18 | unsigned short creator1; 19 | unsigned short creator2; 20 | unsigned int bmp_offset; 21 | } bmpfile_header; 22 | 23 | typedef struct { 24 | unsigned int header_sz; 25 | unsigned int width; 26 | unsigned int height; 27 | unsigned short nplanes; 28 | unsigned short bitspp; 29 | unsigned int compress_type; 30 | unsigned int bmp_bytesz; 31 | unsigned int hres; 32 | unsigned int vres; 33 | unsigned int ncolors; 34 | unsigned int nimpcolors; 35 | } bmp_dib_v3_header_t; 36 | 37 | 38 | typedef enum { 39 | BI_RGB = 0, 40 | BI_RLE8, 41 | BI_RLE4, 42 | BI_BITFIELDS, //Also Huffman 1D compression for BITMAPCOREHEADER2 43 | BI_JPEG, //Also RLE-24 compression for BITMAPCOREHEADER2 44 | BI_PNG, 45 | } bmp_compression_method_t; 46 | 47 | #endif -------------------------------------------------------------------------------- /kernel/common.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMMON_H__ 2 | #define __COMMON_H__ 3 | 4 | #include "ff.h" 5 | 6 | #define SEEK_CUR 1 7 | #define SEEK_END 2 8 | #define SEEK_SET 0 9 | 10 | #define STATUS ((void*)0x10004100) 11 | #define STATUS_LOADING (*(vu32*)(0x10004100)) 12 | #define STATUS_SECTOR (*(vu32*)(0x10004100 + 8)) 13 | #define STATUS_DRIVE (*(float*)(0x1000410C)) 14 | #define STATUS_GB_MB (*(vu32*)(0x10004100 + 16)) 15 | #define STATUS_ERROR (*(vu32*)(0x10004100 + 20)) 16 | 17 | extern void *memset8( void *dst, int x, size_t len ); 18 | extern void *memset16( void *dst, int x, size_t len ); 19 | extern void *memset32( void *dst, int x, size_t len ); 20 | extern u64 read64( u32 addr ); 21 | extern void write64( u32 addr, u64 data ); 22 | 23 | void BootStatus(s32 Value, u32 secs, u32 scnt); 24 | void BootStatusError(s32 Value, s32 error); 25 | void udelay(int us); 26 | void mdelay(int ms); 27 | 28 | /** 29 | * Change non-printable characters in a string to '_'. 30 | * @param str String. 31 | */ 32 | void Asciify(char *str); 33 | 34 | void Shutdown(void) NORETURN; 35 | 36 | /* 37 | * Since Starlet can only access MEM1 via 32-bit write and 8/16 writes 38 | * cause unpredictable results, this code is needed. 39 | * 40 | * This automatically detects the misalignment and writes the value 41 | * via two 32bit writes 42 | */ 43 | 44 | u32 R32(u32 Address); 45 | static inline u16 R16(u32 Address) 46 | { 47 | return R32(Address) >> 16; 48 | } 49 | 50 | void W32(u32 Address, u32 Data); 51 | static inline void W16(u32 Address, u16 Data) 52 | { 53 | u32 Tmp = R32(Address); 54 | W32(Address, (Tmp & 0xFFFF) | (Data << 16)); 55 | } 56 | 57 | void wait_for_ppc(u8 multi); 58 | void InitCurrentTime(); 59 | u32 GetCurrentTime(); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /kernel/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | Comment out the DEBUG variable in global.h to make the preprocessor remove 3 | all normal instances of dbgprintf. Do not include debug.h in: 4 | DI.c 5 | ES.c 6 | FST.c 7 | HID.c 8 | Patch.c 9 | SDI.c 10 | or any header files. 11 | */ 12 | 13 | #ifndef __DEBUG_H___ 14 | #define __DEBUG_H___ 15 | 16 | #include "global.h" 17 | 18 | #ifndef DEBUG 19 | #define dbgprintf(...) 20 | #else 21 | extern int dbgprintf( const char *fmt, ...); 22 | //can track which function calls it via debug.h 23 | //#define dbgprintf(...) dbgprintf( __FUNCTION__ ) 24 | #endif 25 | 26 | #endif -------------------------------------------------------------------------------- /kernel/dol.h: -------------------------------------------------------------------------------- 1 | #ifndef __DOL_H__ 2 | #define __DOL_H__ 3 | 4 | typedef struct { 5 | unsigned int offsetText[7]; 6 | unsigned int offsetData[11]; 7 | unsigned int addressText[7]; 8 | unsigned int addressData[11]; 9 | unsigned int sizeText[7]; 10 | unsigned int sizeData[11]; 11 | unsigned int addressBSS; 12 | unsigned int sizeBSS; 13 | unsigned int entrypoint; 14 | } dolhdr; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /kernel/elf.h: -------------------------------------------------------------------------------- 1 | #ifndef __ELF_H__ 2 | #define __ELF_H__ 3 | #define EI_NIDENT 16 4 | 5 | typedef struct { 6 | unsigned char e_ident[EI_NIDENT]; 7 | unsigned short e_type; 8 | unsigned short e_machine; 9 | unsigned int e_version; 10 | unsigned int e_entry; 11 | unsigned int e_phoff; 12 | unsigned int e_shoff; 13 | unsigned int e_flags; 14 | unsigned short e_ehsize; 15 | unsigned short e_phentsize; 16 | unsigned short e_phnum; 17 | unsigned short e_shentsize; 18 | unsigned short e_shnum; 19 | unsigned short e_shstrndx; 20 | } __attribute__((packed)) Elf32_Ehdr; 21 | 22 | typedef struct { 23 | unsigned int sh_name; 24 | unsigned int sh_type; 25 | unsigned int sh_flags; 26 | unsigned int sh_addr; 27 | unsigned int sh_offset; 28 | unsigned int sh_size; 29 | unsigned int sh_link; 30 | unsigned int sh_info; 31 | unsigned int sh_addralign; 32 | unsigned int sh_entsize; 33 | } __attribute__((packed)) Elf32_Shdr; 34 | 35 | typedef struct { 36 | unsigned int p_type; 37 | unsigned int p_offset; 38 | unsigned int p_vaddr; 39 | unsigned int p_paddr; 40 | unsigned int p_filesz; 41 | unsigned int p_memsz; 42 | unsigned int p_flags; 43 | unsigned int p_align; 44 | } __attribute__((packed)) Elf32_Phdr; 45 | 46 | #define EI_MAG0 0 47 | #define EI_MAG1 1 48 | #define EI_MAG2 2 49 | #define EI_MAG3 3 50 | #define EI_CLASS 4 51 | #define EI_DATA 5 52 | #define EI_VERSION 6 53 | #define EI_PAD 7 54 | #define EI_NIDENT 16 //size of ident 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /kernel/hidmem.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _HIDMEM_H_ 3 | #define _HIDMEM_H_ 4 | static controller *HID_CTRL = (controller*)0x13005000; 5 | static void *HID_Packet = (void*)0x130050F0; 6 | #endif 7 | -------------------------------------------------------------------------------- /kernel/lwbt/btmemb.c: -------------------------------------------------------------------------------- 1 | #include "global.h" 2 | #include "string.h" 3 | #include "bt.h" 4 | #include "btmemb.h" 5 | 6 | void btmemb_init(struct memb_blks *blk) 7 | { 8 | MEMSET(blk->mem,0,(MEM_ALIGN_SIZE(blk->size)+sizeof(u32))*blk->num); 9 | } 10 | 11 | void* btmemb_alloc(struct memb_blks *blk) 12 | { 13 | s32 i; 14 | u32 *ptr; 15 | void *p; 16 | 17 | ptr = (u32*)blk->mem; 18 | for(i=0;inum;i++) { 19 | if(*ptr==0) { 20 | ++(*ptr); 21 | p = (ptr+1); 22 | return p; 23 | } 24 | ptr = (u32*)((u8*)ptr+(MEM_ALIGN_SIZE(blk->size)+sizeof(u32))); 25 | } 26 | return NULL; 27 | } 28 | 29 | u8 btmemb_free(struct memb_blks *blk,void *ptr) 30 | { 31 | u8 ref; 32 | s32 i; 33 | u32 *ptr2,*ptr1; 34 | 35 | ptr1 = ptr; 36 | ptr2 = (u32*)blk->mem; 37 | for(i=0;inum;i++) { 38 | if(ptr2==(ptr1 - 1)) { 39 | ref = --(*ptr2); 40 | return ref; 41 | } 42 | ptr2 = (u32*)((u8*)ptr2+(MEM_ALIGN_SIZE(blk->size)+sizeof(u32))); 43 | } 44 | return -1; 45 | } 46 | 47 | u8 btmemb_ref(struct memb_blks *blk,void *ptr) 48 | { 49 | u8 ref; 50 | u32 *pref; 51 | 52 | pref = ptr-sizeof(u32); 53 | ref = ++(*pref); 54 | return ref; 55 | } 56 | -------------------------------------------------------------------------------- /kernel/lwbt/btmemb.h: -------------------------------------------------------------------------------- 1 | #ifndef __BTMEMB_H__ 2 | #define __BTMEMB_H__ 3 | 4 | #include "global.h" 5 | 6 | #define MEMB(name,size,num) \ 7 | static u8 memb_mem_##name[(MEM_ALIGN_SIZE(size)+sizeof(u32))*num]; \ 8 | static struct memb_blks name = {size,num,memb_mem_##name} 9 | 10 | struct memb_blks { 11 | u16 size; 12 | u16 num; 13 | u8 *mem; 14 | }; 15 | 16 | void btmemb_init(struct memb_blks *blk); 17 | void* btmemb_alloc(struct memb_blks *blk); 18 | u8 btmemb_free(struct memb_blks *blk,void *ptr); 19 | u8 btmemb_ref(struct memb_blks *blk,void *ptr); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /kernel/lwbt/btmemr.h: -------------------------------------------------------------------------------- 1 | #ifndef __BTMEMR_H__ 2 | #define __BTMEMR_H__ 3 | 4 | #include "global.h" 5 | 6 | void btmemr_init(); 7 | void* btmemr_malloc(u32 size); 8 | void btmemr_free(void *ptr); 9 | void* btmemr_realloc(void *ptr,u32 newsize); 10 | void* btmemr_reallocm(void *ptr,u32 newsize); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /kernel/lwbt/btpbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef __BTPBUF_H__ 2 | #define __BTPBUF_H__ 3 | 4 | #include "bt.h" 5 | 6 | /* Definitions for the pbuf flag field. These are NOT the flags that 7 | * are passed to pbuf_alloc(). */ 8 | #define PBUF_FLAG_RAM 0x00U /* Flags that pbuf data is stored in RAM */ 9 | #define PBUF_FLAG_ROM 0x01U /* Flags that pbuf data is stored in ROM */ 10 | #define PBUF_FLAG_POOL 0x02U /* Flags that the pbuf comes from the pbuf pool */ 11 | #define PBUF_FLAG_REF 0x04U /* Flags thet the pbuf payload refers to RAM */ 12 | 13 | typedef enum { 14 | PBUF_TRANSPORT, 15 | PBUF_LINK, 16 | PBUF_RAW 17 | } pbuf_layer; 18 | 19 | typedef enum { 20 | PBUF_POOL, 21 | PBUF_RAM, 22 | PBUF_ROM, 23 | PBUF_REF 24 | } pbuf_flag; 25 | 26 | struct pbuf { 27 | struct pbuf *next; 28 | void *payload; 29 | u16_t tot_len; 30 | u16_t len; 31 | u16_t flags; 32 | u16_t ref; 33 | }; 34 | 35 | void btpbuf_init(); 36 | struct pbuf* btpbuf_alloc(pbuf_layer layer,u16_t len,pbuf_flag flag); 37 | u8_t btpbuf_free(struct pbuf *p); 38 | void btpbuf_realloc(struct pbuf *p,u16_t new_len); 39 | u8_t btpbuf_header(struct pbuf *p,s16_t hdr_size_inc); 40 | void btpbuf_cat(struct pbuf *h,struct pbuf *t); 41 | u8_t btpbuf_clen(struct pbuf *p); 42 | void btpbuf_queue(struct pbuf *p,struct pbuf *n); 43 | void btpbuf_ref(struct pbuf *p); 44 | void btpbuf_chain(struct pbuf *h,struct pbuf *t); 45 | struct pbuf* btpbuf_dequeue(struct pbuf *p); 46 | struct pbuf* btpbuf_dechain(struct pbuf *p); 47 | struct pbuf* btpbuf_take(struct pbuf *p); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /kernel/lwbt/libogc_license.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2004 - 2009 2 | Michael Wiedenbauer (shagkur) 3 | Dave Murphy (WinterMute) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any 7 | damages arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any 10 | purpose, including commercial applications, and to alter it and 11 | redistribute it freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you 14 | must not claim that you wrote the original software. If you use 15 | this software in a product, an acknowledgment in the product 16 | documentation would be appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and 18 | must not be misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source 20 | distribution. 21 | -------------------------------------------------------------------------------- /kernel/lwbt/physbusif.h: -------------------------------------------------------------------------------- 1 | #ifndef __PHYSBUSIF_H__ 2 | #define __PHYSBUSIF_H__ 3 | 4 | #include "btpbuf.h" 5 | 6 | typedef struct _usb_p usb_p; 7 | typedef s32 (*pbcallback)(s32 state,s32 result,usb_p *usb); 8 | 9 | struct _usb_p 10 | { 11 | s32 fd; 12 | u8 acl_out; 13 | u8 acl_in; 14 | u8 hci_evt; 15 | u8 hci_ctrl; 16 | u32 vid; 17 | u32 pid; 18 | u8 openstate; 19 | }; 20 | 21 | void physbusif_init(); 22 | void physbusif_close(); 23 | void physbusif_shutdown(); 24 | void physbusif_reset_all(); 25 | void physbusif_output(struct pbuf *p,u16_t len); 26 | void physbusif_input(); 27 | 28 | s32 __readintrdataCB(); 29 | s32 __readbulkdataCB(); 30 | 31 | u32 __issue_intrread(); 32 | u32 __issue_bulkread(); 33 | #endif 34 | -------------------------------------------------------------------------------- /kernel/start.s: -------------------------------------------------------------------------------- 1 | .global _start 2 | .type _start STT_FUNC 3 | .extern __phy_stack_addr 4 | .extern __bss_start 5 | .extern __bss_end 6 | .extern _main 7 | .arm 8 | 9 | .EQU ios_thread_arg, 5 10 | .EQU ios_thread_priority, 0x7F 11 | .EQU ios_thread_stacksize, 0x2000 12 | 13 | _start: 14 | @ setup stack 15 | ldr sp, =__phy_stack_addr 16 | 17 | mov r5, r0 18 | mov r6, lr 19 | 20 | @ take the plunge 21 | mov r0, r5 22 | mov lr, r6 23 | mov r1, #0 24 | blx _main 25 | 26 | -------------------------------------------------------------------------------- /kernel/string.h: -------------------------------------------------------------------------------- 1 | #ifndef __STRING_H__ 2 | #define __STRING_H__ 3 | 4 | #include 5 | #include "global.h" 6 | #include "common.h" 7 | #include "vsprintf.h" 8 | 9 | char *strcpy(char *, const char *); 10 | char *strncpy(char *, const char *, size_t); 11 | size_t strlcpy(char *dest, const char *src, size_t maxlen); 12 | char * strstr ( const char *str1, const char *str2); 13 | int strcmp(const char *, const char *); 14 | int strncmp(const char *p, const char *q, size_t n); 15 | size_t strlen(const char *); 16 | size_t strnlen(const char *, size_t); 17 | char *strchr(const char *s, int c); 18 | int memcmp(const void *s1, const void *s2, size_t n); 19 | void *memset(void *dst, int x, size_t n); 20 | extern void *memcpy( void *dst, const void *src, size_t size); 21 | 22 | int _sprintf( char *buf, const char *fmt, ... ); 23 | 24 | #ifdef DEBUG 25 | void hexdump(void *d, int len); 26 | #else 27 | #define hexdump(...) 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /kernel/usbstorage.h: -------------------------------------------------------------------------------- 1 | #ifndef __USBSTORAGE_H__ 2 | #define __USBSTORAGE_H__ 3 | 4 | #define USBSTORAGE_OK 0 5 | #define USBSTORAGE_ENOINTERFACE -10000 6 | #define USBSTORAGE_ESENSE -10001 7 | #define USBSTORAGE_ESHORTWRITE -10002 8 | #define USBSTORAGE_ESHORTREAD -10003 9 | #define USBSTORAGE_ESIGNATURE -10004 10 | #define USBSTORAGE_ETAG -10005 11 | #define USBSTORAGE_ESTATUS -10006 12 | #define USBSTORAGE_EDATARESIDUE -10007 13 | #define USBSTORAGE_ETIMEDOUT -10008 14 | #define USBSTORAGE_EINIT -10009 15 | #define USBSTORAGE_PROCESSING -10010 16 | 17 | #define B_RAW_DEVICE_DATA_IN 0x01 18 | #define B_RAW_DEVICE_COMMAND 0 19 | 20 | typedef struct { 21 | uint8_t command[16]; 22 | uint8_t command_length; 23 | uint8_t flags; 24 | uint8_t scsi_status; 25 | void* data; 26 | size_t data_length; 27 | } raw_device_command; 28 | 29 | bool USBStorage_Startup(void); 30 | bool USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer); 31 | bool USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer); 32 | void USBStorage_Shutdown(void); 33 | 34 | #endif /* __USBSTORAGE_H__ */ 35 | -------------------------------------------------------------------------------- /kernel/vsprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef __VSPRINTF_H__ 2 | #define __VSPRINTF_H__ 3 | 4 | #include 5 | #include "string.h" 6 | 7 | int _vsprintf(char *buf, const char *fmt, va_list args); 8 | int _sprintf( char *buf, const char *fmt, ... ); 9 | //int dbgprintf( const char *fmt, ...); 10 | void CheckOSReport(void); 11 | void closeLog(void); 12 | #endif -------------------------------------------------------------------------------- /kernel/wdvd.h: -------------------------------------------------------------------------------- 1 | #ifndef _FILEOP_H_ 2 | #define _FILEOP_H_ 3 | 4 | s32 WDVD_Init(void); 5 | s32 WDVD_Close(void); 6 | s32 WDVD_Read(void *buf, u32 len, u64 offset); 7 | s32 WDVD_GetHandle(); 8 | 9 | bool WDVD_FST_IsMounted(); 10 | bool WDVD_FST_Mount(); 11 | int WDVD_FST_Open(const char *path); 12 | int WDVD_FST_OpenDisc(u32 discNum); 13 | u32 WDVD_FST_LSeek(u32 pos); 14 | int WDVD_FST_Read(u8 *ptr, s32 len); 15 | int WDVD_FST_Close(); 16 | bool WDVD_FST_Unmount(); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /kernel/zip/zip.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/kernel/zip/zip.exe -------------------------------------------------------------------------------- /kernelboot/_start.S: -------------------------------------------------------------------------------- 1 | .extern _main 2 | .globl _start 3 | _start: 4 | push {fp,lr} 5 | bl _main 6 | pop {fp,lr} 7 | bx lr 8 | -------------------------------------------------------------------------------- /kernelboot/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | Nintendont Kernelboot 3 | 4 | Copyright (C) 2017 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #include "syscalls.h" 20 | 21 | //called on ES Ioctl 0x1F 22 | void _main() 23 | { 24 | //Just a jump at this location to our set entry 25 | void *threadVirt = 0; 26 | if(*(volatile unsigned int*)0x20109740 == 0xE59F1004) 27 | threadVirt = (void*)0x20109740; //Address on Wii 28 | else if(*(volatile unsigned int*)0x2010999C == 0xE59F1004) 29 | threadVirt = (void*)0x2010999C; //Address on WiiU 30 | //Will be used by threadVirt 31 | *(volatile unsigned int*)0x12FFFFE0 = 0x12F00000; //Nintendont Entry 32 | sync_after_write((void*)0x12FFFFE0, 0x20); 33 | //Start Thread 34 | int ret = thread_create(threadVirt,(void*)0,(void*)(0x12FA6000+0x2000),(0x2000>>2),0x78,1); 35 | thread_continue(ret); 36 | } 37 | -------------------------------------------------------------------------------- /kernelboot/syscalls.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SYSCALLS_H__ 3 | #define __SYSCALLS_H__ 4 | 5 | unsigned int thread_create( unsigned int (*proc)(void* arg), void* arg, unsigned int* stack, unsigned int stacksize, unsigned char priority, char detach ); 6 | int thread_continue( int ThreadID ); 7 | 8 | void sync_before_read(void *ptr, int len); 9 | void sync_after_write(void *ptr, int len); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /kernelboot/syscalls.s: -------------------------------------------------------------------------------- 1 | 2 | .section ".text" 3 | .align 4 4 | .arm 5 | .global thread_create 6 | .type thread_create STT_FUNC 7 | thread_create: 8 | .long 0xe6000010 9 | bx lr 10 | 11 | .global thread_continue 12 | .type thread_continue STT_FUNC 13 | thread_continue: 14 | .long 0xe60000b0 15 | bx lr 16 | 17 | .global sync_before_read 18 | .type sync_before_read STT_FUNC 19 | sync_before_read: 20 | .long 0xe60007f0 21 | bx lr 22 | 23 | .global sync_after_write 24 | .type sync_after_write STT_FUNC 25 | sync_after_write: 26 | .long 0xe6000810 27 | bx lr 28 | 29 | .pool 30 | .end 31 | -------------------------------------------------------------------------------- /loader/data/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/data/background.png -------------------------------------------------------------------------------- /loader/data/font.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/data/font.zip -------------------------------------------------------------------------------- /loader/extlibs/include/freetype/config/ftmodule.h: -------------------------------------------------------------------------------- 1 | /* This is a generated file. */ 2 | FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) 3 | FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) 4 | FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) 5 | FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) 6 | FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) 7 | FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) 8 | FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) 9 | FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) 10 | FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) 11 | FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) 12 | FT_USE_MODULE( FT_Module_Class, autofit_module_class ) 13 | FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) 14 | FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) 15 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) 16 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) 17 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) 18 | FT_USE_MODULE( FT_Module_Class, psaux_module_class ) 19 | FT_USE_MODULE( FT_Module_Class, psnames_module_class ) 20 | /* EOF */ 21 | -------------------------------------------------------------------------------- /loader/extlibs/lib/libfreetype.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/extlibs/lib/libfreetype.a -------------------------------------------------------------------------------- /loader/extlibs/lib/libpng.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/extlibs/lib/libpng.a -------------------------------------------------------------------------------- /loader/extlibs/lib/libpngu.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/extlibs/lib/libpngu.a -------------------------------------------------------------------------------- /loader/extlibs/lib/libwiidrc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/extlibs/lib/libwiidrc.a -------------------------------------------------------------------------------- /loader/extlibs/lib/libwupc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/extlibs/lib/libwupc.a -------------------------------------------------------------------------------- /loader/extlibs/lib/libz.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/extlibs/lib/libz.a -------------------------------------------------------------------------------- /loader/include/Config.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #ifndef __CONFIG_H__ 22 | #define __CONFIG_H__ 23 | 24 | #include "../../common/include/CommonConfig.h" 25 | 26 | #endif -------------------------------------------------------------------------------- /loader/include/ELF.h: -------------------------------------------------------------------------------- 1 | #ifndef __ELF_H__ 2 | #define __ELF_H__ 3 | 4 | #define EI_NIDENT 16 5 | 6 | typedef struct { 7 | unsigned char e_ident[EI_NIDENT]; 8 | unsigned short e_type; 9 | unsigned short e_machine; 10 | unsigned int e_version; 11 | unsigned int e_entry; 12 | unsigned int e_phoff; 13 | unsigned int e_shoff; 14 | unsigned int e_flags; 15 | unsigned short e_ehsize; 16 | unsigned short e_phentsize; 17 | unsigned short e_phnum; 18 | unsigned short e_shentsize; 19 | unsigned short e_shnum; 20 | unsigned short e_shstrndx; 21 | } Elf32_Ehdr; 22 | 23 | typedef struct { 24 | unsigned int sh_name; 25 | unsigned int sh_type; 26 | unsigned int sh_flags; 27 | unsigned int sh_addr; 28 | unsigned int sh_offset; 29 | unsigned int sh_size; 30 | unsigned int sh_link; 31 | unsigned int sh_info; 32 | unsigned int sh_addralign; 33 | unsigned int sh_entsize; 34 | } Elf32_Shdr; 35 | 36 | typedef struct { 37 | unsigned int p_type; 38 | unsigned int p_offset; 39 | unsigned int p_vaddr; 40 | unsigned int p_paddr; 41 | unsigned int p_filesz; 42 | unsigned int p_memsz; 43 | unsigned int p_flags; 44 | unsigned int p_align; 45 | } Elf32_Phdr; 46 | 47 | #define EI_MAG0 0 48 | #define EI_MAG1 1 49 | #define EI_MAG2 2 50 | #define EI_MAG3 3 51 | #define EI_CLASS 4 52 | #define EI_DATA 5 53 | #define EI_VERSION 6 54 | #define EI_PAD 7 55 | #define EI_NIDENT 16 //size of ident 56 | 57 | #endif -------------------------------------------------------------------------------- /loader/include/FPad.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #ifndef __FPAD_H__ 22 | #define __FPAD_H__ 23 | 24 | #include "global.h" 25 | #include 26 | #include 27 | 28 | struct BTPadCont { 29 | u32 used; 30 | s16 xAxisL; 31 | s16 xAxisR; 32 | s16 yAxisL; 33 | s16 yAxisR; 34 | u32 button; 35 | u8 triggerL; 36 | u8 triggerR; 37 | s16 xAccel; 38 | s16 yAccel; 39 | s16 zAccel; 40 | } __attribute__((aligned(32))); 41 | 42 | void FPAD_Init( void ); 43 | void FPAD_Update( void ); 44 | 45 | bool FPAD_Up( bool ILock ); 46 | bool FPAD_Down( bool ILock ); 47 | bool FPAD_Left( bool ILock ); 48 | bool FPAD_Right( bool ILock ); 49 | bool FPAD_OK( bool ILock ); 50 | bool FPAD_Cancel( bool ILock ); 51 | bool FPAD_Start( bool ILock ); 52 | bool FPAD_X( bool ILock ); 53 | bool FPAD_Y( bool ILock ); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /loader/include/HID.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __HID_H__ 3 | #define __HID_H__ 4 | 5 | void HIDUpdateRegisters(); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /loader/include/MemCard.h: -------------------------------------------------------------------------------- 1 | /* 2 | MemCard.h for Nintendont (Kernel) 3 | 4 | Copyright (C) 2014 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __MEMCARD_H__ 21 | #define __MEMCARD_H__ 22 | 23 | /** 24 | * Create a blank memory card image. 25 | * @param MemCard Memory card filename. 26 | * @param BI2region bi2.bin region code. 27 | * @return True on success; false on error. 28 | */ 29 | bool GenerateMemCard(const char *MemCard, u32 BI2region); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /loader/include/Patches.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #ifndef __PATCHES_H__ 22 | #define __PATCHES_H__ 23 | 24 | #include 25 | #include 26 | #include "global.h" 27 | 28 | void PatchKernel(); 29 | int LoadKernel(); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /loader/include/ShowGameInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | "Game Info" screen. 5 | 6 | Copyright (C) 2013 crediar 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation version 2. 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 for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | 21 | */ 22 | 23 | #ifndef __SHOW_GAME_INFO_H__ 24 | #define __SHOW_GAME_INFO_H__ 25 | 26 | #include "menu.h" 27 | 28 | /** 29 | * Show a game's information. 30 | * @param gameinfo Game to show. 31 | */ 32 | void ShowGameInfo(const gameinfo *gi); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /loader/include/TRI.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2015 FIX94 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #ifndef _TRI_H_ 22 | #define _TRI_H_ 23 | 24 | u32 TRISetupGames(char *Path, unsigned int CurDICMD, u32 ISOShift); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /loader/include/exi.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | 22 | #ifndef __EXI_H_ // __EXI_H__ is defined in ogc/exi.h :( 23 | #define __EXI_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | #include "global.h" 29 | 30 | void CheckForGecko(void); 31 | void closeLog(void); 32 | 33 | #ifdef DEBUG 34 | // FIXME: Commit this first, and find other 35 | // printf-style functions to add printf 36 | // attributes to. 37 | /** 38 | * Log a debug message. 39 | * - Wii: Logs to USB Gecko. 40 | * - Wii U: Logs to a file on the root device. 41 | * @param str printf-style format string. 42 | * @param ... printf arguments. 43 | * @return vsnprintf() return value; 0 if nothing was written; or -1 on error. 44 | */ 45 | int gprintf(const char *str, ...) 46 | __attribute__ ((format (printf, 1, 2))); 47 | #else 48 | #define gprintf(...) 0 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /loader/include/font.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | 22 | #ifndef __FONT_H__ 23 | #define __FONT_H__ 24 | 25 | void PrintFormat(u8 size, const u32 color, int x, int y, const char *str, ... ) 26 | __attribute__ ((format (printf, 5, 6))); 27 | 28 | #endif -------------------------------------------------------------------------------- /loader/include/http.h: -------------------------------------------------------------------------------- 1 | #ifndef _HTTP_H_ 2 | #define _HTTP_H_ 3 | 4 | #include 5 | #define TCP_CONNECT_TIMEOUT 5000 6 | #define TCP_BLOCK_SIZE (16 * 1024) 7 | #define TCP_BLOCK_RECV_TIMEOUT 4000 8 | #define TCP_BLOCK_SEND_TIMEOUT 4000 9 | 10 | s32 tcp_socket (void); 11 | s32 tcp_connect (char *host, const u16 port); 12 | 13 | char * tcp_readln (const s32 s, const u16 max_length, const u64 start_time, const u16 timeout); 14 | bool tcp_read (const s32 s, u8 **buffer, const u32 length); 15 | bool tcp_write (const s32 s, const u8 *buffer, const u32 length); 16 | 17 | #define HTTP_TIMEOUT 300000 18 | 19 | typedef enum { 20 | HTTPR_OK, 21 | HTTPR_ERR_CONNECT, 22 | HTTPR_ERR_REQUEST, 23 | HTTPR_ERR_STATUS, 24 | HTTPR_ERR_TOOBIG, 25 | HTTPR_ERR_RECEIVE 26 | } http_res; 27 | 28 | bool http_request (const char *url, const u32 max_size); 29 | bool http_post (const char *url, const u32 max_size, const char *postData); 30 | bool http_get_result (unsigned int *http_status, u8 **content, unsigned int *length); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /loader/include/ipl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _IPL_H_ 3 | #define _IPL_H_ 4 | 5 | void load_ipl(unsigned char *buf); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /loader/include/ssl.h: -------------------------------------------------------------------------------- 1 | /* Code taken from http://wiibrew.org/wiki//dev/net/ssl/code */ 2 | 3 | #ifndef _SSL_H_ 4 | #define _SSL_H_ 5 | 6 | #define IOCTLV_SSL_NEW 1 7 | #define IOCTLV_SSL_CONNECT 2 8 | #define IOCTLV_SSL_HANDSHAKE 3 9 | #define IOCTLV_SSL_READ 4 10 | #define IOCTLV_SSL_WRITE 5 11 | #define IOCTLV_SSL_SHUTDOWN 6 12 | #define IOCTLV_SSL_SETROOTCA 10 13 | #define IOCTLV_SSL_SETBUILTINCLIENTCERT 14 14 | 15 | #define SSL_HEAP_SIZE 0xB000 16 | 17 | u32 ssl_init(void); 18 | u32 ssl_open(void); 19 | u32 ssl_close(void); 20 | s32 ssl_new(u8 * CN, u32 verify_options); 21 | s32 ssl_setbuiltinclientcert(s32 ssl_context, s32 index); 22 | s32 ssl_setrootca(s32 ssl_context, const void *root, u32 length); 23 | s32 ssl_connect(s32 ssl_context, s32 socket); 24 | s32 ssl_handshake(s32 ssl_context); 25 | s32 ssl_read(s32 ssl_context, void* buffer, u32 length); 26 | s32 ssl_write(s32 ssl_context, const void * buffer, u32 length); 27 | s32 ssl_shutdown(s32 ssl_context); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /loader/include/titles.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2014 JoostinOnline 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | 22 | #ifndef __TITLES_H__ 23 | #define __TITLES_H__ 24 | 25 | /** 26 | * Load game titles from titles.txt. 27 | * @return Number of titles loaded. 28 | */ 29 | int LoadTitles(void); 30 | 31 | /** 32 | * Find a title in the titles database. 33 | * Loaded from titles.txt, plus special exceptions for Triforce. 34 | * @param titleID [in] Title ID. (ID6) 35 | * @param pIsTriforce [out,opt] Set to true if this is a Triforce title. 36 | * @return Title, or NULL if not found. 37 | * WARNING: DO NOT FREE the returned title! 38 | */ 39 | const char *SearchTitles(const char *titleID, bool *pIsTriforce); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /loader/include/update.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2014 JoostinOnline 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | 22 | #ifndef __UPDATE_H__ 23 | #define __UPDATE_H__ 24 | 25 | void UpdateNintendont(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /loader/include/usbstorage_ogc.h: -------------------------------------------------------------------------------- 1 | #ifndef __USBSTORAGE_OGC_H__ 2 | #define __USBSTORAGE_OGC_H__ 3 | 4 | #if defined(HW_RVL) 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | s32 USBStorageOGC_Initialize(); 16 | 17 | s32 USBStorageOGC_Open(usbstorage_handle *dev, s32 device_id, u16 vid, u16 pid); 18 | s32 USBStorageOGC_Close(usbstorage_handle *dev); 19 | s32 USBStorageOGC_Reset(usbstorage_handle *dev); 20 | 21 | s32 USBStorageOGC_GetMaxLUN(usbstorage_handle *dev); 22 | s32 USBStorageOGC_MountLUN(usbstorage_handle *dev, u8 lun); 23 | s32 USBStorageOGC_Suspend(usbstorage_handle *dev); 24 | s32 USBStorageOGC_IsDVD(); 25 | s32 USBStorageOGC_ioctl(int request, ...); 26 | 27 | s32 USBStorageOGC_ReadCapacity(usbstorage_handle *dev, u8 lun, u32 *sector_size, u32 *n_sectors); 28 | s32 USBStorageOGC_Read(usbstorage_handle *dev, u8 lun, u32 sector, u16 n_sectors, u8 *buffer); 29 | s32 USBStorageOGC_Write(usbstorage_handle *dev, u8 lun, u32 sector, u16 n_sectors, const u8 *buffer); 30 | s32 USBStorageOGC_StartStop(usbstorage_handle *dev, u8 lun, u8 lo_ej, u8 start, u8 imm); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif /* __cplusplus */ 35 | 36 | #endif /* HW_RVL */ 37 | 38 | #endif /* __USBSTORAGE_H__ */ 39 | -------------------------------------------------------------------------------- /loader/include/verify_md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | MD5sum verifier. 5 | 6 | Copyright (C) 2013 crediar 7 | 8 | This program is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License 10 | as published by the Free Software Foundation version 2. 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 for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | 21 | */ 22 | 23 | #ifndef __VERIFY_MD5_H__ 24 | #define __VERIFY_MD5_H__ 25 | 26 | #include "menu.h" 27 | 28 | /** 29 | * Verify a game's MD5. 30 | * @param gameinfo Game to verify. 31 | */ 32 | void VerifyMD5(const gameinfo *gi); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /loader/include/wdvd.h: -------------------------------------------------------------------------------- 1 | #ifndef _FILEOP_H_ 2 | #define _FILEOP_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | s32 WDVD_Init(void); 14 | s32 WDVD_OpenDataPartition(); 15 | s32 WDVD_Close(void); 16 | s32 WDVD_Read(void *buf, u32 len, u64 offset); 17 | s32 WDVD_ClosePartition(void); 18 | s32 WDVD_GetHandle(); 19 | bool WDVD_IsPartitionOpen(); 20 | 21 | bool WDVD_FST_IsMounted(); 22 | bool WDVD_FST_Mount(); 23 | int WDVD_FST_Open(const char *path); 24 | int WDVD_FST_OpenDisc(u32 discNum); 25 | u32 WDVD_FST_LSeek(u32 pos); 26 | int WDVD_FST_Read(u8 *ptr, s32 len); 27 | int WDVD_FST_Close(); 28 | bool WDVD_FST_Unmount(); 29 | 30 | //aligned for smaller reads under 0x20 31 | extern u8 wdvdTmpBuf[]; 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /loader/loader.dol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/loader/loader.dol -------------------------------------------------------------------------------- /loader/source/HID.c: -------------------------------------------------------------------------------- 1 | // HID controller configuration loader. 2 | #include 3 | #include "exi.h" 4 | #include "HID.h" 5 | #include "ff_utf8.h" 6 | 7 | #define HID_STATUS 0xD3003440 8 | #define HID_CHANGE (HID_STATUS+4) 9 | #define HID_CFG_SIZE (HID_STATUS+8) 10 | 11 | #define HID_CFG_FILE 0x93003460 12 | 13 | void HIDUpdateRegisters() 14 | { 15 | if(*(vu32*)HID_CHANGE == 0) 16 | return; 17 | unsigned int DeviceVID = *(vu32*)HID_CHANGE; 18 | unsigned int DevicePID = *(vu32*)HID_CFG_SIZE; 19 | gprintf("Trying to get VID%04x PID%04x\n", DeviceVID, DevicePID); 20 | 21 | /* I hope this covers all possible ini files */ 22 | char file_sd[40]; 23 | char file_usb[40]; 24 | snprintf(file_sd, sizeof(file_sd), "sd:/controllers/%04X_%04X.ini", DeviceVID, DevicePID); 25 | snprintf(file_usb, sizeof(file_usb), "usb:/controllers/%04X_%04X.ini", DeviceVID, DevicePID); 26 | 27 | const char *const filenames[6] = 28 | { 29 | file_sd, file_usb, 30 | "sd:/controller.ini", 31 | "sd:/controller.ini.ini", 32 | "usb:/controller.ini", 33 | "usb:/controller.ini.ini" 34 | }; 35 | 36 | int i; 37 | FIL f; 38 | FRESULT res = FR_DISK_ERR; 39 | for (i = 0; i < 6; i++) 40 | { 41 | res = f_open_char(&f, filenames[i], FA_READ|FA_OPEN_EXISTING); 42 | if (res == FR_OK) 43 | break; 44 | } 45 | 46 | if (res == FR_OK) 47 | { 48 | size_t fsize = f.obj.objsize; 49 | UINT read; 50 | f_read(&f, (void*)HID_CFG_FILE, fsize, &read); 51 | DCFlushRange((void*)HID_CFG_FILE, fsize); 52 | f_close(&f); 53 | *(vu32*)HID_CFG_SIZE = fsize; 54 | } 55 | else 56 | { 57 | // No controller configuration file. 58 | *(vu32*)HID_CFG_SIZE = 0; 59 | } 60 | 61 | *(vu32*)HID_CHANGE = 0; 62 | } 63 | -------------------------------------------------------------------------------- /loader/source/font.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "font.h" 31 | #include "global.h" 32 | 33 | void PrintFormat(u8 size, const u32 color, int x, int y, const char *str, ... ) 34 | { 35 | char astr[2048]; 36 | 37 | va_list ap; 38 | va_start( ap, str ); 39 | 40 | vsnprintf(astr, sizeof(astr), str, ap); 41 | 42 | va_end( ap ); 43 | GRRLIB_PrintfTTF(x, y, myFont, astr, size, color); 44 | } 45 | -------------------------------------------------------------------------------- /loader/source/ipl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ipl.h" 4 | 5 | // bootrom descrambler reversed by segher 6 | // Copyright 2008 Segher Boessenkool 7 | void Descrambler(unsigned char* data, unsigned int size) 8 | { 9 | unsigned char acc = 0; 10 | unsigned char nacc = 0; 11 | 12 | unsigned short t = 0x2953; 13 | unsigned short u = 0xd9c2; 14 | unsigned short v = 0x3ff1; 15 | 16 | unsigned char x = 1; 17 | unsigned int it; 18 | for (it = 0; it < size; ) 19 | { 20 | int t0 = t & 1; 21 | int t1 = (t >> 1) & 1; 22 | int u0 = u & 1; 23 | int u1 = (u >> 1) & 1; 24 | int v0 = v & 1; 25 | 26 | x ^= t1 ^ v0; 27 | x ^= (u0 | u1); 28 | x ^= (t0 ^ u1 ^ v0) & (t0 ^ u0); 29 | 30 | if (t0 == u0) 31 | { 32 | v >>= 1; 33 | if (v0) 34 | v ^= 0xb3d0; 35 | } 36 | 37 | if (t0 == 0) 38 | { 39 | u >>= 1; 40 | if (u0) 41 | u ^= 0xfb10; 42 | } 43 | 44 | t >>= 1; 45 | if (t0) 46 | t ^= 0xa740; 47 | 48 | nacc++; 49 | acc = 2*acc + x; 50 | if (nacc == 8) 51 | { 52 | data[it++] ^= acc; 53 | nacc = 0; 54 | } 55 | } 56 | } 57 | 58 | #define IPL_ROM_FONT_SJIS 0x1AFF00 59 | 60 | #define DECRYPT_START 0x100 61 | #define CODE_START 0x820 62 | 63 | void load_ipl(unsigned char *buf) 64 | { 65 | Descrambler(buf + DECRYPT_START, IPL_ROM_FONT_SJIS - DECRYPT_START); 66 | memcpy((void*)0x81300000, buf + CODE_START, IPL_ROM_FONT_SJIS - CODE_START); 67 | DCFlushRange((void*)0x81300000, IPL_ROM_FONT_SJIS - CODE_START); 68 | } 69 | -------------------------------------------------------------------------------- /loader/source/jmp813.S: -------------------------------------------------------------------------------- 1 | 2 | .extern __InitBATS 3 | .extern __InitPS 4 | .extern __InitFPRS 5 | .extern __InitCache 6 | .extern __InitSystem 7 | 8 | .globl _jmp813 9 | _jmp813: 10 | bl __InitBATS # Initialize BATs to a clear and known state 11 | bl __initRegisters # Initialize the General Purpose Registers 12 | bl __InitPS # Initialize Paired Singles 13 | bl __InitFPRS # Initialize the FPR's 14 | bl __InitCache # Initialize the system caches 15 | bl __InitSystem # Initialize more cache aspects, clear a few SPR's, and disable interrupts. 16 | lis r3, 0x8130 17 | mtlr r3 18 | blr 19 | 20 | __initRegisters: 21 | li r0,0 22 | li r3,0 23 | li r4,0 24 | li r5,0 25 | li r6,0 26 | li r7,0 27 | li r8,0 28 | li r9,0 29 | li r10,0 30 | li r11,0 31 | li r12,0 32 | li r14,0 33 | li r15,0 34 | li r16,0 35 | li r17,0 36 | li r18,0 37 | li r19,0 38 | li r20,0 39 | li r21,0 40 | li r22,0 41 | li r23,0 42 | li r24,0 43 | li r25,0 44 | li r26,0 45 | li r27,0 46 | li r28,0 47 | li r29,0 48 | li r30,0 49 | li r31,0 50 | blr 51 | -------------------------------------------------------------------------------- /loader/source/ppc/IOSInterface/include/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from the Twilight Hack */ 9 | // Copyright 2008-2009 Segher Boessenkool 10 | // Copyright 2008-2009 Hector Martin 11 | 12 | #ifndef __CACHE_H__ 13 | #define __CACHE_H__ 14 | 15 | typedef unsigned long long u64; 16 | typedef unsigned int u32; 17 | typedef unsigned short u16; 18 | typedef unsigned char u8; 19 | 20 | void sync_before_read(void *p, u32 len); 21 | void sync_after_write(const void *p, u32 len); 22 | void sync_after_store(const void *p, u32 len); 23 | void sync_before_exec(const void *p, u32 len); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /loader/source/ppc/IOSInterface/link.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_FORMAT("elf32-powerpc") 3 | OUTPUT_ARCH(powerpc:common) 4 | 5 | ENTRY(__start) 6 | 7 | SECTIONS { 8 | /* placed in by kernel Patch.c */ 9 | OSSleepThread = 0x93026C84; 10 | OSWakeupThread = 0x93026C88; 11 | OSCreateThread = 0x93026C8C; 12 | OSResumeThread = 0x93026C90; 13 | DHCPStateOffset = 0x93026C94; 14 | SOStartedOffset = 0x93026C96; 15 | SOShift = 0x93026C98; 16 | SOCurrentTotalFDs = 0x93026C9A; 17 | IsInited = 0x93026C9C; 18 | 19 | .code 0x93006000 : 20 | { 21 | _crt0.o(*) 22 | *(.text) 23 | *(.rodata .rodata.*) 24 | *(.data) 25 | *(.bss) 26 | . = 0xA000; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /loader/source/ppc/IOSInterface/source/cache.c: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from the Twilight Hack */ 9 | // Copyright 2008-2009 Segher Boessenkool 10 | // Copyright 2008-2009 Hector Martin 11 | 12 | #include "cache.h" 13 | 14 | // this saves 12 bytes 15 | static void syncret(void) __attribute__((noinline)); 16 | static void syncret(void) 17 | { 18 | asm("sync ; isync"); 19 | } 20 | 21 | void sync_before_read(void *p, u32 len) 22 | { 23 | u32 a, b; 24 | 25 | a = (u32)p & ~0x1f; 26 | b = ((u32)p + len + 0x1f) & ~0x1f; 27 | 28 | for ( ; a < b; a += 32) 29 | asm("dcbi 0,%0" : : "b"(a) : "memory"); 30 | 31 | syncret(); 32 | } 33 | 34 | void sync_after_write(const void *p, u32 len) 35 | { 36 | u32 a, b; 37 | 38 | a = (u32)p & ~0x1f; 39 | b = ((u32)p + len + 0x1f) & ~0x1f; 40 | 41 | for ( ; a < b; a += 32) 42 | asm("dcbf 0,%0" : : "b"(a)); 43 | 44 | syncret(); 45 | } 46 | 47 | void sync_after_store(const void *p, u32 len) 48 | { 49 | u32 a, b; 50 | 51 | a = (u32)p & ~0x1f; 52 | b = ((u32)p + len + 0x1f) & ~0x1f; 53 | 54 | for ( ; a < b; a += 32) 55 | asm("dcbst 0,%0" : : "b"(a)); 56 | 57 | syncret(); 58 | } 59 | 60 | void sync_before_exec(const void *p, u32 len) 61 | { 62 | u32 a, b; 63 | 64 | a = (u32)p & ~0x1f; 65 | b = ((u32)p + len + 0x1f) & ~0x1f; 66 | 67 | for ( ; a < b; a += 32) 68 | asm("dcbst 0,%0 ; sync ; icbi 0,%0" : : "b"(a)); 69 | 70 | syncret(); 71 | } 72 | -------------------------------------------------------------------------------- /loader/source/ppc/PADReadGC/include/hidmem.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _HIDMEM_H_ 3 | #define _HIDMEM_H_ 4 | static volatile controller *HID_CTRL = (volatile controller*)0x93005000; 5 | static vu8 *HID_Packet = (vu8*)0x930050F0; 6 | #endif 7 | -------------------------------------------------------------------------------- /loader/source/ppc/PADReadGC/include/wiidrc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 FIX94 3 | * 4 | * This software may be modified and distributed under the terms 5 | * of the MIT license. See the LICENSE file for details. 6 | */ 7 | #ifndef _WIIDRC_H_ 8 | #define _WIIDRC_H_ 9 | 10 | #define WIIDRC_BUTTON_A 0x8000 11 | #define WIIDRC_BUTTON_B 0x4000 12 | #define WIIDRC_BUTTON_X 0x2000 13 | #define WIIDRC_BUTTON_Y 0x1000 14 | #define WIIDRC_BUTTON_LEFT 0x0800 15 | #define WIIDRC_BUTTON_RIGHT 0x0400 16 | #define WIIDRC_BUTTON_UP 0x0200 17 | #define WIIDRC_BUTTON_DOWN 0x0100 18 | #define WIIDRC_BUTTON_ZL 0x0080 19 | #define WIIDRC_BUTTON_ZR 0x0040 20 | #define WIIDRC_BUTTON_L 0x0020 21 | #define WIIDRC_BUTTON_R 0x0010 22 | #define WIIDRC_BUTTON_PLUS 0x0008 23 | #define WIIDRC_BUTTON_MINUS 0x0004 24 | #define WIIDRC_BUTTON_HOME 0x0002 25 | 26 | #define WIIDRC_EXTRA_BUTTON_L3 0x80 27 | #define WIIDRC_EXTRA_BUTTON_R3 0x40 28 | #define WIIDRC_EXTRA_BUTTON_TV 0x30 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /loader/source/ppc/PADReadGC/link.ld: -------------------------------------------------------------------------------- 1 | 2 | OUTPUT_FORMAT("elf32-powerpc") 3 | OUTPUT_ARCH(powerpc:common) 4 | 5 | ENTRY(__start) 6 | 7 | SECTIONS { 8 | .code 0x93000000 : 9 | { 10 | _crt0.o(*) 11 | *(.text) 12 | *(.rodata .rodata.*) 13 | *(.data) 14 | *(.bss) 15 | . = 0x3000; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /loader/source/ppc/PADReadGC/source/_crt0.S: -------------------------------------------------------------------------------- 1 | 2 | # full list of the functions we can jump to 3 | .extern PADRead 4 | .extern KeyboardRead 5 | 6 | .globl __start 7 | __start: 8 | b PADRead 9 | b KeyboardRead 10 | 11 | # just some helper functions 12 | .globl disableIRQs 13 | disableIRQs: 14 | mfmsr 3 15 | rlwinm 4,3,0,17,15 16 | mtmsr 4 17 | extrwi 3,3,1,16 18 | blr 19 | 20 | .globl restoreIRQs 21 | restoreIRQs: 22 | cmpwi 3,0 23 | mfmsr 4 24 | beq doRestDisable 25 | # re-enable interrupts 26 | ori 5,4,0x8000 27 | b restoreSetVal 28 | doRestDisable: 29 | rlwinm 5,4,0,17,15 30 | restoreSetVal: 31 | mtmsr 5 32 | extrwi 3,4,1,16 33 | blr 34 | 35 | .globl disableCaches 36 | disableCaches: 37 | sync 38 | isync 39 | mfspr 3,1008 40 | rlwinm 3,3,0,18,15 41 | mtspr 1008,3 42 | blr 43 | 44 | .globl bootStub 45 | bootStub: 46 | lis 3, 0x8000 47 | ori 3, 3, 0x4000 48 | mtlr 3 49 | blr 50 | -------------------------------------------------------------------------------- /loader/source/unzip/miniunz.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _miniunz_H 3 | #define _miniunz_H 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "unzip.h" 10 | 11 | int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password); 12 | int makedir(char *newdir); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /multidol/Makefile: -------------------------------------------------------------------------------- 1 | 2 | PREFIX = $(DEVKITPPC)/bin/powerpc-eabi- 3 | 4 | AR = $(PREFIX)ar 5 | AS = $(PREFIX)as 6 | CC = $(PREFIX)gcc 7 | CXX = $(PREFIX)g++ 8 | LD = $(PREFIX)ld 9 | OBJCOPY = $(PREFIX)objcopy 10 | RANLIB = $(PREFIX)ranlib 11 | STRIP = $(PREFIX)strip 12 | 13 | MACHDEP = -mcpu=750 -meabi -mhard-float 14 | CFLAGS = $(MACHDEP) -O1 -s -Werror -Wall -fdata-sections -ffunction-sections 15 | LDFLAGS = $(MACHDEP) -n -nostartfiles -nostdlib -Wl,--gc-sections,-T,openstub.ld -L. 16 | ASFLAGS = -D_LANGUAGE_ASSEMBLY -DHW_RVL 17 | 18 | TARGET_LINKED = multidol_ldr.elf 19 | TARGET = ../loader/data/multidol_ldr.bin 20 | 21 | CFILES = cache.c main.c global.c apploader.c dip.c utils.c 22 | OBJS = crt0.o cache.o main.o global.o apploader.o dip.o utils.o 23 | 24 | DEPDIR = .deps 25 | 26 | LIBS = 27 | 28 | all: $(TARGET) 29 | 30 | %.o: %.s 31 | @echo " ASSEMBLE $<" 32 | @$(CC) $(CFLAGS) $(DEFINES) $(ASFLAGS) -c $< -o $@ 33 | 34 | %.o: %.S 35 | @echo " ASSEMBLE $<" 36 | @$(CC) $(CFLAGS) $(DEFINES) $(ASFLAGS) -c $< -o $@ 37 | 38 | %.o: %.c 39 | @echo " COMPILE $<" 40 | @$(CC) $(CFLAGS) $(DEFINES) -c $< -o $@ 41 | 42 | $(TARGET_LINKED): $(OBJS) 43 | @echo " LINK $@" 44 | @$(CC) -g -o $@ $(LDFLAGS) $(OBJS) $(LIBS) 45 | 46 | $(TARGET): $(TARGET_LINKED) 47 | @echo " OBJCOPY $@" 48 | @$(OBJCOPY) -O binary -S $< $@ 49 | 50 | clean: 51 | -$(RM) -rf $(TARGET_LINKED) $(TARGET) $(OBJS) $(DEPDIR) 52 | -------------------------------------------------------------------------------- /multidol/apploader.h: -------------------------------------------------------------------------------- 1 | /* 2 | apploader.h for Nintendont (Loader) 3 | 4 | Copyright (C) 2014 FIX94 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | as published by the Free Software Foundation version 2. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | #ifndef __APPLOADER_H__ 20 | #define __APPLOADER_H__ 21 | 22 | typedef struct _FST 23 | { 24 | union 25 | { 26 | struct 27 | { 28 | unsigned int Type :8; 29 | unsigned int NameOffset :24; 30 | }; 31 | unsigned int TypeName; 32 | }; 33 | union 34 | { 35 | struct 36 | { 37 | unsigned int FileOffset; 38 | unsigned int FileLength; 39 | }; 40 | struct 41 | { 42 | unsigned int ParentOffset; 43 | unsigned int NextOffset; 44 | }; 45 | unsigned int entry[2]; 46 | }; 47 | } FST; 48 | 49 | struct _TGCInfo 50 | { 51 | u32 tgcoffset; 52 | u32 doloffset; 53 | u32 fstoffset; 54 | u32 fstsize; 55 | u32 userpos; 56 | u32 fstupdate; 57 | u32 isTGC; 58 | }; 59 | u32 Apploader_Run(); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /multidol/cache.c: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from the Twilight Hack */ 9 | // Copyright 2008-2009 Segher Boessenkool 10 | // Copyright 2008-2009 Hector Martin 11 | 12 | #include "cache.h" 13 | 14 | // this saves 12 bytes 15 | static void syncret(void) __attribute__((noinline)); 16 | static void syncret(void) 17 | { 18 | asm("sync ; isync"); 19 | } 20 | 21 | void sync_before_read(void *p, u32 len) 22 | { 23 | u32 a, b; 24 | 25 | a = (u32)p & ~0x1f; 26 | b = ((u32)p + len + 0x1f) & ~0x1f; 27 | 28 | for ( ; a < b; a += 32) 29 | asm("dcbi 0,%0" : : "b"(a) : "memory"); 30 | 31 | syncret(); 32 | } 33 | 34 | void sync_after_write(const void *p, u32 len) 35 | { 36 | u32 a, b; 37 | 38 | a = (u32)p & ~0x1f; 39 | b = ((u32)p + len + 0x1f) & ~0x1f; 40 | 41 | for ( ; a < b; a += 32) 42 | asm("dcbf 0,%0" : : "b"(a)); 43 | 44 | syncret(); 45 | } 46 | 47 | void sync_before_exec(const void *p, u32 len) 48 | { 49 | u32 a, b; 50 | 51 | a = (u32)p & ~0x1f; 52 | b = ((u32)p + len + 0x1f) & ~0x1f; 53 | 54 | for ( ; a < b; a += 32) 55 | asm("dcbst 0,%0 ; sync ; icbi 0,%0" : : "b"(a)); 56 | 57 | syncret(); 58 | } 59 | -------------------------------------------------------------------------------- /multidol/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from the Twilight Hack */ 9 | // Copyright 2008-2009 Segher Boessenkool 10 | // Copyright 2008-2009 Hector Martin 11 | 12 | #ifndef __CACHE_H__ 13 | #define __CACHE_H__ 14 | 15 | #include "types.h" 16 | 17 | void sync_before_read(void *p, u32 len); 18 | void sync_after_write(const void *p, u32 len); 19 | void sync_before_exec(const void *p, u32 len); 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /multidol/crt0.S: -------------------------------------------------------------------------------- 1 | # Copyright 2008-2009 Segher Boessenkool 2 | # This code is licensed to you under the terms of the GNU GPL, version 2; 3 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 4 | 5 | .extern _main 6 | .globl _start 7 | _start: 8 | 9 | # Setup stack. 10 | lis %sp, __stack_top@ha ; addi %sp,%sp,__stack_top@l ; li %r0,0 ; stwu %r0,-0x40(%sp) 11 | 12 | # Clear BSS. 13 | lis %r3,__bss_start@ha ; addi %r3,%r3,__bss_start@l 14 | li %r4,0 15 | lis %r5,__bss_end@ha ; addi %r5,%r5,__bss_end@l ; sub %r5,%r5,%r3 16 | bl _memset 17 | 18 | # Go! 19 | bl _main 20 | 21 | #goto entrypoint 22 | mtlr %r3 23 | blr 24 | -------------------------------------------------------------------------------- /multidol/dip.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #include "cache.h" 22 | #include "dip.h" 23 | #include "utils.h" 24 | int DVDLowRead( void *ptr, u32 len, u32 offset ) 25 | { 26 | sync_after_write(ptr, len); 27 | 28 | DI_STATUS = 0x2A | 0x14; // clear IRQs 29 | DI_CMD_0 = 0xF8000000; 30 | DI_CMD_1 = ((u32)offset)>>2; 31 | DI_CMD_2 = len; 32 | DI_DMA_ADR = (u32)ptr; 33 | DI_DMA_LEN = len; 34 | 35 | //Start cmd! 36 | DI_CONTROL = 3; 37 | while( DI_CONTROL & 1 ); 38 | 39 | sync_before_read(ptr, len); 40 | return 1; 41 | } 42 | -------------------------------------------------------------------------------- /multidol/global.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #include "utils.h" 22 | #include "global.h" 23 | #include "cache.h" 24 | 25 | void RAMInit(void) 26 | { 27 | u32 vmode = *(vu32*)0x800000CC; 28 | 29 | _memset( (void*)0x80000020, 0, 0xE0 ); //Keep ISO Header 30 | _memset( (void*)0x80003000, 0, 0x12FD000 ); 31 | sync_before_exec( (void*)0x80003000, 0x12FD000 ); 32 | _memset( (void*)0x81310000, 0, 0x4F0000 ); 33 | sync_before_exec( (void*)0x81340000, 0x4F0000 ); 34 | *(vu32*)0x80000020 = 0x0D15EA5E; 35 | *(vu32*)0x80000028 = 0x01800000; 36 | *(vu32*)0x8000002C = *(vu32*)0xCC00302C >> 28; // console type 37 | *(vu32*)0x800000CC = vmode; //Assuming it didnt change 38 | *(vu32*)0x800000F0 = 0x01800000; 39 | 40 | *(vu16*)0xCC00501A = 156; 41 | } 42 | -------------------------------------------------------------------------------- /multidol/global.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Nintendont (Loader) - Playing Gamecubes in Wii mode on a Wii U 4 | 5 | Copyright (C) 2013 crediar 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation version 2. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | */ 21 | #ifndef __GLOBAL_H__ 22 | #define __GLOBAL_H__ 23 | 24 | void RAMInit(void); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /multidol/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from HBC's stub which was based on dhewg's geckoloader stub */ 9 | // Copyright 2008-2009 Andre Heider 10 | // Copyright 2008-2009 Hector Martin 11 | 12 | #include "cache.h" 13 | #include "dip.h" 14 | #include "utils.h" 15 | #include "global.h" 16 | #include "apploader.h" 17 | 18 | u32 _main() 19 | { 20 | RAMInit(); 21 | return Apploader_Run(); 22 | } 23 | -------------------------------------------------------------------------------- /multidol/openstub.ld: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | OUTPUT_FORMAT("elf32-powerpc") 9 | OUTPUT_ARCH(powerpc:common) 10 | 11 | ENTRY(_start) 12 | 13 | PHDRS { 14 | app PT_LOAD FLAGS(7); 15 | } 16 | 17 | SECTIONS { 18 | . = 0x81300000; 19 | 20 | .text : { *(.text) *(.text.*) } :app 21 | 22 | .data : { *(.data) *(.data.*) } 23 | .rodata : { *(.rodata) *(.rodata.*) } 24 | 25 | __bss_start = .; 26 | .bss : { *(.bss) *(.bss.*) } 27 | __bss_end = .; 28 | 29 | __stack_end = .; 30 | .stack : { 31 | . = . + 0x2000; 32 | __stack_top = .; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /multidol/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | // Copyright 2008-2009 Hector Martin 9 | 10 | #ifndef __TYPES_H__ 11 | #define __TYPES_H__ 12 | 13 | typedef volatile unsigned char vu8; 14 | typedef volatile unsigned short vu16; 15 | typedef volatile unsigned int vu32; 16 | typedef volatile unsigned long long vu64; 17 | 18 | typedef unsigned char u8; 19 | typedef unsigned short u16; 20 | typedef unsigned int u32; 21 | typedef unsigned long long u64; 22 | 23 | typedef char s8; 24 | typedef short s16; 25 | typedef int s32; 26 | typedef long long s64; 27 | 28 | #define NULL ((void *)0) 29 | 30 | #define ALIGNED(n) __attribute__((aligned(n))) 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /multidol/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from HBC's stub which was based on geckoloader and the Twilight Hack code */ 9 | /* Some of these routines are from public domain sources */ 10 | // Copyright 2008-2009 Segher Boessenkool 11 | // Copyright 2008-2009 Andre Heider 12 | // Copyright 2008-2009 Hector Martin 13 | 14 | #include "types.h" 15 | #include "utils.h" 16 | 17 | static u32 get_time(void) 18 | { 19 | u32 x; 20 | 21 | asm volatile("mftb %0" : "=r"(x)); 22 | 23 | return x; 24 | } 25 | 26 | void usleep(u32 us) 27 | { 28 | u32 _start = get_time(); 29 | while ((get_time() - _start) < (91*us)) ; 30 | } 31 | 32 | void _memcpy(void *ptr, const void *src, u32 size) 33 | { 34 | char* ptr2 = ptr; 35 | const char* src2 = src; 36 | while(size--) *ptr2++ = *src2++; 37 | } 38 | 39 | void _memset(void *ptr, int c, u32 size) 40 | { 41 | char* ptr2 = ptr; 42 | while(size--) *ptr2++ = c; 43 | } -------------------------------------------------------------------------------- /multidol/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | // Copyright 2008-2009 Hector Martin 9 | 10 | #ifndef __UTILS_H__ 11 | #define __UTILS_H__ 12 | 13 | #include "types.h" 14 | 15 | void usleep(u32 us); 16 | void _memcpy(void *ptr, const void *src, u32 size); 17 | void _memset(void *ptr, int c, u32 size); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /nintendont/gcn_md5.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/nintendont/gcn_md5.zip -------------------------------------------------------------------------------- /nintendont/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FIX94/Nintendont/8f4324d95048e24bcf7e80b863f823a56c54647e/nintendont/icon.png -------------------------------------------------------------------------------- /nintendont/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Nintendont 4 | FIX94, crediar 5 | 4.431 6 | 20161218000000 7 | Gamecube Loader 8 | Commiters: GerbilSoft, JoostinOnline, GreyRogue, Howard, Cyan, nastys 9 | 10 | Project website: https://github.com/FIX94/Nintendont 11 | 12 | Nintendont allows you to run GameCube games on a Wii or Wii U from an SD or HDD device. 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /resetstub/cache.c: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from the Twilight Hack */ 9 | // Copyright 2008-2009 Segher Boessenkool 10 | // Copyright 2008-2009 Hector Martin 11 | 12 | #include "types.h" 13 | 14 | void sync_before_read(void *p, u32 len) 15 | { 16 | u32 a, b; 17 | 18 | a = (u32)p & ~0x1f; 19 | b = ((u32)p + len + 0x1f) & ~0x1f; 20 | 21 | for ( ; a < b; a += 32) 22 | asm("dcbi 0,%0" : : "b"(a) : "memory"); 23 | 24 | asm("sync ; isync"); 25 | } 26 | 27 | void sync_after_write(const void *p, u32 len) 28 | { 29 | u32 a, b; 30 | 31 | a = (u32)p & ~0x1f; 32 | b = ((u32)p + len + 0x1f) & ~0x1f; 33 | 34 | for ( ; a < b; a += 32) 35 | asm("dcbf 0,%0" : : "b"(a)); 36 | 37 | asm("sync ; isync"); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /resetstub/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from the Twilight Hack */ 9 | // Copyright 2008-2009 Segher Boessenkool 10 | // Copyright 2008-2009 Hector Martin 11 | 12 | #ifndef __CACHE_H__ 13 | #define __CACHE_H__ 14 | 15 | #include "types.h" 16 | 17 | void sync_before_read(void *p, u32 len); 18 | void sync_after_write(const void *p, u32 len); 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /resetstub/ios.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | #ifndef __IOS_H__ 9 | #define __IOS_H__ 10 | 11 | // Copyright 2008-2009 Hector Martin 12 | 13 | #include "types.h" 14 | 15 | struct ioctlv { 16 | void *data; 17 | u32 len; 18 | }; 19 | 20 | void ios_cleanup(void); 21 | int ios_open(const char *filename, u32 mode); 22 | int ios_close(int fd); 23 | int ios_ioctlv(int fd, u32 n, u32 in_count, u32 out_count, struct ioctlv *vec); 24 | int ios_ioctlvreboot(int fd, u32 n, u32 in_count, u32 out_count, struct ioctlv *vec); 25 | int ios_read(int fd, void *buf, u32 size); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /resetstub/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEMORY_H__ 2 | #define __MEMORY_H__ 3 | 4 | void __temp_abe(void); 5 | void ICInvalidateRange(void *, int); 6 | void DCFlashInvalidate(void *, int); 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /resetstub/openstub.ld: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | OUTPUT_FORMAT("elf32-powerpc") 9 | OUTPUT_ARCH(powerpc:common) 10 | 11 | ENTRY(_start) 12 | 13 | PHDRS { 14 | app PT_LOAD FLAGS(7); 15 | } 16 | 17 | SECTIONS { 18 | . = 0x80004000; 19 | 20 | .text : { *(.text) *(.text.*) } :app 21 | 22 | .data : { *(.data) *(.data.*) } 23 | .rodata : { *(.rodata) *(.rodata.*) } 24 | 25 | __bss_start = .; 26 | .bss : { *(.bss) *(.bss.*) } 27 | __bss_end = .; 28 | 29 | __stack_end = .; 30 | .stack : { 31 | . = . + 0x8000; 32 | __stack_top = .; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /resetstub/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | // Copyright 2008-2009 Hector Martin 9 | 10 | #ifndef __TYPES_H__ 11 | #define __TYPES_H__ 12 | 13 | typedef volatile unsigned char vu8; 14 | typedef volatile unsigned short vu16; 15 | typedef volatile unsigned int vu32; 16 | typedef volatile unsigned long long vu64; 17 | 18 | typedef unsigned char u8; 19 | typedef unsigned short u16; 20 | typedef unsigned int u32; 21 | typedef unsigned long long u64; 22 | 23 | typedef char s8; 24 | typedef short s16; 25 | typedef int s32; 26 | typedef long long s64; 27 | 28 | #define NULL ((void *)0) 29 | 30 | #define ALIGNED(n) __attribute__((aligned(n))) 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /resetstub/usbgecko.h: -------------------------------------------------------------------------------- 1 | #ifndef __USBGECKO_H__ 2 | #define __USBGECKO_H__ 3 | 4 | #define USBGECKO_CMD_IDENTIFY 0x90000000 5 | #define USBGECKO_IDENTIFY_RESPONSE 0x04700000 6 | #define USBGECKO_CMD_TX_STATUS 0xc0000000 7 | #define USBGECKO_TX_FIFO_READY 0x04000000 8 | #define USBGECKO_CMD_RX_STATUS 0xd0000000 9 | #define USBGECKO_RX_FIFO_READY 0x04000000 10 | #define USBGECKO_CMD_RECEIVE 0xa0000000 11 | #define USBGECKO_CMD_TRANSMIT(ch) (0xb0000000 | ((ch) << 20)) 12 | 13 | void usbgecko_putch(char ch); 14 | void usbgecko_printf(const char* string); 15 | void usbgecko_init(); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /resetstub/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | /* This code comes from HBC's stub which was based on geckoloader and the Twilight Hack code */ 9 | /* Some of these routines are from public domain sources */ 10 | // Copyright 2008-2009 Segher Boessenkool 11 | // Copyright 2008-2009 Andre Heider 12 | // Copyright 2008-2009 Hector Martin 13 | 14 | #include "types.h" 15 | #include "utils.h" 16 | 17 | static u32 get_time(void) 18 | { 19 | u32 x; 20 | 21 | asm volatile("mftb %0" : "=r"(x)); 22 | 23 | return x; 24 | } 25 | 26 | void usleep(u32 us) 27 | { 28 | u32 _start = get_time(); 29 | while ((get_time() - _start) < (91*us)) ; 30 | } 31 | 32 | void _memcpy(void *ptr, const void *src, u32 size) 33 | { 34 | char* ptr2 = ptr; 35 | const char* src2 = src; 36 | while(size--) *ptr2++ = *src2++; 37 | } -------------------------------------------------------------------------------- /resetstub/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyLoad - a simple region free (original) game launcher in 4k 3 | 4 | # This code is licensed to you under the terms of the GNU GPL, version 2; 5 | # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 6 | */ 7 | 8 | // Copyright 2008-2009 Hector Martin 9 | 10 | #ifndef __UTILS_H__ 11 | #define __UTILS_H__ 12 | 13 | #include "types.h" 14 | 15 | void usleep(u32 us); 16 | void _memcpy(void *ptr, const void *src, u32 size); 17 | 18 | #endif 19 | --------------------------------------------------------------------------------