├── - - Build Executable.bat ├── - - Melee Code Manager Debug.bat ├── .gitattributes ├── .gitignore ├── .include ├── melee ├── melee.s ├── melee_modules │ ├── DVD.s │ ├── GObj.s │ ├── GX.s │ ├── HSDObj.s │ ├── MPad.s │ ├── _template.s │ ├── all.s │ ├── arch.s │ ├── arch_resources │ │ ├── bin │ │ │ ├── hello.wrl │ │ │ └── mono.bmp │ │ ├── build │ │ │ ├── hello_wrl.s │ │ │ └── test_hax.s │ │ └── example_files │ │ │ ├── test_GProc │ │ │ ├── _main.s │ │ │ ├── data.s │ │ │ ├── proc.s │ │ │ └── setup.s │ │ │ ├── test_MPad │ │ │ ├── _main.s │ │ │ ├── data_hello_wrl.s │ │ │ ├── hello_wrl.s │ │ │ ├── nop.s │ │ │ └── proc.s │ │ │ └── test_hax_syncCB.s │ ├── common.s │ ├── mem.s │ ├── ppc.s │ └── prim.s ├── punkpc.s └── punkpc │ ├── README.md │ ├── align.s │ ├── bcount.s │ ├── branch.s │ ├── cr.s │ ├── data.s │ ├── dbg.s │ ├── en.s │ ├── enc.s │ ├── enum.s │ ├── errata.s │ ├── gecko.s │ ├── hex.s │ ├── hidden.s │ ├── idxr.s │ ├── if.s │ ├── ifalt.s │ ├── ifdef.s │ ├── ifnum.s │ ├── items.s │ ├── library.s │ ├── list.s │ ├── lmf.s │ ├── load.s │ ├── mut.s │ ├── obj.s │ ├── ppc.s │ ├── regs.s │ ├── sidx.s │ ├── small.s │ ├── sp.s │ ├── spr.s │ ├── stack.s │ ├── str.s │ ├── xem.s │ └── xev.s ├── About.txt ├── LICENSE ├── Melee Code Manager.py ├── Mods Library ├── Characters.txt ├── Debug Codes.txt ├── Game Mode & Item Codes.txt ├── Mechanics.txt ├── Menus │ ├── Character Select Screen.txt │ ├── Global Effects & Unlocks.txt │ ├── Other Menu Behaviors & Features.txt │ └── Stage Select & Results Screen.txt ├── Stages.txt ├── Visuals.txt └── _funcs │ ├── !ReadMe.txt │ ├── Cast.txt │ ├── DVD.txt │ ├── Data.txt │ ├── HSD │ ├── Arch │ │ ├── Operations.txt │ │ └── Symbol Handlers │ │ │ └── Default.txt │ ├── GObj │ │ ├── !Callbacks │ │ │ ├── GProc.txt │ │ │ ├── GXCamera.txt │ │ │ └── GXDraw.txt │ │ ├── Constructors.txt │ │ └── Operations.txt │ └── Obj │ │ ├── AObj │ │ ├── Constructors.txt │ │ └── Operations.txt │ │ ├── CObj │ │ ├── Constructors.txt │ │ └── Operations.txt │ │ ├── DObj │ │ └── Constructors.txt │ │ ├── Fog │ │ └── Constructors.txt │ │ ├── JObj │ │ ├── Constructors.txt │ │ └── Operations.txt │ │ ├── MObj │ │ └── Constructors.txt │ │ ├── PObj │ │ └── Constructors.txt │ │ ├── TObj │ │ ├── Constructors.txt │ │ └── Operations.txt │ │ └── WObj │ │ └── Constructors.txt │ ├── Math │ ├── Math.txt │ ├── Mtx.txt │ ├── Rand.txt │ └── Trig.txt │ ├── Mem.txt │ └── Misc │ ├── Audio.txt │ ├── Logger │ ├── Operations.txt │ └── Utilities.txt │ └── Visual │ ├── GX.txt │ └── Prim.txt ├── Original DOLs ├── NTSC 1.00.dol ├── NTSC 1.01.dol ├── NTSC 1.02.dol ├── PAL 1.00.dol └── ReadMe.txt ├── README.md ├── appIcon1.3.ico ├── bin ├── codehandler.bin └── eabi │ ├── powerpc-eabi-as.exe │ ├── powerpc-eabi-ld.exe │ ├── powerpc-eabi-objcopy.exe │ └── vdappc.exe ├── commonGuiModules.py ├── defaultOptions.ini ├── imgs ├── Bowser2.png ├── appIcon.png ├── bobombWalking.png ├── bobombsSitting.png ├── books.png ├── editButton.png ├── editButtonGray.png ├── folderIcon.png ├── geckoIndicator.png ├── githubLink.png ├── githubLinkGray.png ├── injectionIndicator.png ├── p1Indicator.png ├── p2Indicator.png ├── p3Indicator.png ├── p4Indicator.png ├── randall.png ├── searchIcon.png ├── smashboardsLink.png ├── smashboardsLinkGray.png ├── standaloneIndicator.png ├── staticIndicator.png ├── updateArrow.png ├── youtubeLink.png └── youtubeLinkGray.png ├── newTkDnD.py ├── playsound.py ├── settings.py ├── setup.py ├── sfx ├── menuBack.wav ├── menuChange.wav └── menuSelect.wav └── tk └── tkdnd2.7 ├── x64 ├── libtkdnd2.7.dll ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl └── tkdnd_windows.tcl └── x86 ├── libtkdnd2.7.dll ├── pkgIndex.tcl ├── tkdnd.tcl ├── tkdnd_compat.tcl ├── tkdnd_generic.tcl ├── tkdnd_macosx.tcl ├── tkdnd_unix.tcl └── tkdnd_windows.tcl /- - Build Executable.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cls 3 | 4 | echo. & echo. 5 | echo Are you sure you'd like to compile (y/n)? 6 | 7 | set /p confirmation= 8 | 9 | :: Compile the program if "y" was entered 10 | echo. & echo. 11 | if [%confirmation%]==[y] ( 12 | echo Deleting bin\tempFiles 13 | del /Q bin\tempFiles 14 | echo. 15 | python setup.py build 16 | ) else ( 17 | goto:eof 18 | ) 19 | 20 | echo. & echo. 21 | echo Exit Code: %ERRORLEVEL% 22 | 23 | if not [%ERRORLEVEL%]==[0] goto :Failed 24 | 25 | 26 | 27 | :Success 28 | echo. 29 | echo Build complete! Press any key to exit. 30 | pause > nul 31 | 32 | :: Open the target build folder 33 | "%SystemRoot%\explorer.exe" "%~dp0build" 34 | goto :eof 35 | 36 | 37 | 38 | :Failed 39 | echo. 40 | echo Build failed. Press any key to exit. 41 | pause > nul -------------------------------------------------------------------------------- /- - Melee Code Manager Debug.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | python "%~dp0Melee Code Manager.py" %* 4 | 5 | :: If there are no errors, exit. Otherwise, pause so that the errors can be read. 6 | if [%ERRORLEVEL%]==[0] goto eof 7 | 8 | pause -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore compiled python files 2 | *.pyc 3 | 4 | # Ignore the options.ini file (user settings) 5 | # But keeping the "defaultOptions.ini" file, which 6 | # will be included and renamed when compiled. 7 | options.ini 8 | 9 | # Ignore directories output by build operations 10 | /[Bb]uild*/ 11 | 12 | # Ignore program temporary files 13 | bin/tempFiles/ 14 | 15 | # Visual Studio Code project folder 16 | .vscode -------------------------------------------------------------------------------- /.include/melee: -------------------------------------------------------------------------------- 1 | .ifndef melee.library.included 2 | .include "punkpc.s" 3 | module.library melee, ".s", all 4 | .endif 5 | melee.maindir "melee_modules/" 6 | melee.subdir, ".s" 7 | -------------------------------------------------------------------------------- /.include/melee.s: -------------------------------------------------------------------------------- 1 | .ifndef melee.library.included 2 | .include "punkpc.s" 3 | module.library melee, ".s", all 4 | .endif 5 | melee.maindir "melee_modules/" 6 | melee.subdir, ".s" 7 | -------------------------------------------------------------------------------- /.include/melee_modules/DVD.s: -------------------------------------------------------------------------------- 1 | .ifndef melee.library.included; .include "melee"; .endif 2 | melee.module DVD 3 | .if module.included == 0 4 | punkpc regs 5 | melee arch 6 | 7 | 8 | # --- SDATA offsets 9 | r13.xFSTEntries = -0x4424 10 | r13.xFSTPaths = -0x4420 11 | r13.xFSTCount = -0x441C 12 | r13.xDVDAsyncQueue = -0x3ea8 13 | 14 | 15 | 16 | # --- RETURNS for 17 | # args: r3=rFile (== rNum, rPath, or rOffset) 18 | DVD.file.rNum = r3 19 | DVD.file.rPath = r4 20 | DVD.file.rSize = r5 21 | DVD.file.rAlign = r6 22 | DVD.file.rOffset = r7 23 | DVD.file.rFST = r8 24 | DVD.file.rFile = r9 25 | DVD.file.bInvalid = cr1.eq 26 | 27 | # rFST: 28 | FST.xStr = 0x0 29 | FST.xOffset = 0x4 30 | FST.xSize = 0x8 31 | FST.size = 0xC 32 | 33 | 34 | 35 | # --- RETURNS for 36 | # args: r3=rQuery 37 | DVD.async_info.rAsync = r3 38 | DVD.async_info.rNum = r4 39 | DVD.async_info.rQuery = r5 40 | DVD.async_info.bNotSynced = cr1.lt 41 | DVD.async_info.bMatch = cr1.gt 42 | DVD.async_info.bSynced = cr1.eq 43 | 44 | # rAsync: 45 | DVD.async_info.xNext = 0x00 46 | DVD.async_info.xIDX = 0x04 47 | DVD.async_info.xNum = 0x08 48 | DVD.async_info.xStart = 0x0C 49 | DVD.async_info.xDest = 0x10 50 | DVD.async_info.xSize = 0x14 51 | DVD.async_info.xFlags = 0x18 52 | DVD.async_info.xError = 0x1A 53 | DVD.async_info.xSyncCB = 0x1C 54 | DVD.async_info.xSyncArg = 0x20 55 | 56 | 57 | # --- RETURNS for all variations of 58 | # args: r3=rFile, r4=rOut, r5=... (additional args vary by function) 59 | DVD.read.rNum = r3 60 | DVD.read.rOut = r4 61 | DVD.read.rStart = r5 62 | DVD.read.rSize = r6 63 | DVD.read.rSyncCB = r7 64 | DVD.read.rArch = r8 65 | DVD.read.rMeta = r9 66 | DVD.read.rPath = r10 67 | DVD.read.rAsync = r11 68 | DVD.read.bNotSynced = cr1.lt 69 | DVD.read.bInvalid = cr1.eq 70 | 71 | 72 | # --- ARGUMENTS for sync callbacks 73 | # --> passed to rSyncCB on asynchronous reads 74 | DVD.sync.rID = r3 75 | DVD.sync.rSyncArg = r4 76 | DVD.sync.rErrorID = r6 77 | 78 | .endif 79 | -------------------------------------------------------------------------------- /.include/melee_modules/MPad.s: -------------------------------------------------------------------------------- 1 | .ifndef melee.library.included; .include "melee"; .endif 2 | melee.module MPad 3 | .if module.included == 0 4 | # --- MPad structure 5 | MPad.addr = 0x804C1FAC 6 | # This base address can be used to reach the vanilla MPad structures, without any codes 7 | 8 | MPad.size = 0x44 9 | # There are 5 MPads in an array. You can index them with this size value 10 | 11 | MPad.xP1 = MPad.size * 0 12 | MPad.P1 = MPad.addr + MPad.xP1 13 | # controller 1 (P1) 14 | 15 | MPad.xP2 = MPad.size * 1 16 | MPad.P2 = MPad.addr + MPad.xP2 17 | # controller 2 (P2) 18 | 19 | MPad.xP3 = MPad.size * 2 20 | MPad.P3 = MPad.addr + MPad.xP3 21 | # controller 3 (P3) 22 | MPad.xP4 = MPad.size * 3 23 | MPad.P4 = MPad.addr + MPad.xP4 24 | # controller 4 (P4) 25 | 26 | MPad.xAny = MPad.size * 4 27 | MPad.Any = MPad.addr + MPad.xAny 28 | # any controller (detects all controllers in common struct) 29 | 30 | # --- Controller Digital Data bools - these are mapped in each of the button fields 31 | MPad.crf.mCStick = 0x20 32 | MPad.bCStick = 8; MPad.mCStick = 0xF00000 # --- CStick nibble 33 | MPad.bCRight = 8; MPad.mCRight = 0x800000 # Right on CStick 34 | MPad.bCLeft = 9; MPad.mCLeft = 0x400000 # Left on CStick 35 | MPad.bCDown = 10; MPad.mCDown = 0x200000 # Down on CStick 36 | MPad.bCUp = 11; MPad.mCUp = 0x100000 # Up on CStick 37 | 38 | MPad.crf.mStick = 0x10 39 | MPad.bStick = 12; MPad.mStick = 0x0F0000 # --- Stick nibble 40 | MPad.bRight = 12; MPad.mRight = 0x080000 # Right on Directional-Stick 41 | MPad.bLeft = 13; MPad.mLeft = 0x040000 # Left on Directional-Stick 42 | MPad.bDown = 14; MPad.mDown = 0x020000 # Down on Directional-Stick 43 | MPad.bUp = 15; MPad.mUp = 0x010000 # Up on Directional-Stick 44 | 45 | MPad.crf.mOther = 0x8 46 | MPad.bOther = 16; MPad.mOther = 0x00F000 # --- Other nibble 47 | MPad.bStart = 19; MPad.mStart = 0x001000 # Start Button 48 | 49 | MPad.crf.mButtons = 0x4 50 | MPad.bButtons = 20; MPad.mButtons = 0x000F00 # --- Buttons nibble 51 | MPad.bY = 20; MPad.mY = 0x000800 # Y Button 52 | MPad.bX = 21; MPad.mX = 0x000400 # X Button 53 | MPad.bB = 22; MPad.mB = 0x000200 # B Button 54 | MPad.bA = 23; MPad.mA = 0x000100 # A Button 55 | 56 | MPad.crf.mShoulders = 0x2 57 | MPad.bShoulders = 24; MPad.mShoulders = 0x0000F0 # --- Shoulders nibble 58 | MPad.bL = 25; MPad.mL = 0x000040 # L Shoulder -- heavy press only 59 | MPad.bR = 26; MPad.mR = 0x000020 # R Shoulder -- heavy press only 60 | MPad.bZ = 27; MPad.mZ = 0x000010 # Z Button 61 | 62 | MPad.crf.mDPad = 0x1 63 | MPad.bDPad = 28; MPad.mDPad = 0x00000F # --- DPad nibble 64 | MPad.bDUp = 28; MPad.mDUp = 0x000008 # Left on Digital-Pad 65 | MPad.bDDown = 29; MPad.mDDown = 0x000004 # Right on Digital-Pad 66 | MPad.bDRight = 30; MPad.mDRight = 0x000002 # Up on Digital-Pad 67 | MPad.bDLeft = 31; MPad.mDLeft = 0x000001 # Down on Digital-Pad 68 | # MPad.crf.m* values can be used to generate masks for mtcrf instructions 69 | 70 | 71 | # --- Digital Data Fields - these use the above bools to capture digital state of controller 72 | # raw data: 73 | MPad.xOnThis = 0x00 # Controller Digital Data (this frame) 74 | MPad.xOnPrev = 0x04 # Controller Digital Data (previous frame) 75 | 76 | # filtered Data: 77 | MPad.xOnPress = 0x08 # Instant of Button Press 78 | MPad.xOnAuto = 0x0C # Automatic Tick (using repeater) -- repeating instant when buttons are held 79 | MPad.xOnRelease = 0x10 # Instant of Button Release 80 | 81 | # The repeater countdown powers the OnAuto tick: 82 | MPad.xRepeater = 0x14 # repeater wait countdown (sets to 45 on any input, when 0: resets to 8) 83 | # - the repeater triggers OnAuto to recoccur when reaching 0, causing a reset of the repeater count 84 | # - repeater continuously samples the OnThis field holding a button, but only on each tick frame 85 | 86 | 87 | # --- Analog Bytes - these are condensed integer-versions of the floating point data below it 88 | MPad.xByteX = 0x18 # SIGNED Analog Directional-Stick X byte 89 | MPad.xByteY = 0x19 # SIGNED Analog Directional-Stick Y byte 90 | MPad.xByteCX = 0x1A # SIGNED Analog C-Stick X byte 91 | MPad.xByteCY = 0x1B # SIGNED Analog C-Stick Y byte 92 | MPad.xByteR = 0x1C # UNSIGNED Analog R byte 93 | MPad.xByteL = 0x1D # UNSIGNED Analog L byte 94 | MPad.xByteA = 0x1E # - these last 2 are not used, as far as I know 95 | MPad.xByteB = 0x1F # - 96 | 97 | 98 | # --- Analog Floats - these are floats polled from the analog sensors in the controller 99 | MPad.xAnalogX = 0x20 # Analog Directional-Stick X 100 | MPad.xAnalogY = 0x24 # Analog Directional-Stick Y 101 | MPad.xAnalogCX = 0x28 # Analog C-Stick X 102 | MPad.xAnalogCY = 0x2C # Analog C-Stick Y 103 | MPad.xAnalogR = 0x30 # Analog R 104 | MPad.xAnalogL = 0x34 # Analog L 105 | MPad.xAnalogA = 0x38 # - 106 | MPad.xAnalogB = 0x3C # - 107 | 108 | 109 | # --- Error Code - detects status of the controller with error codes 110 | MPad.xErr = 0x41 # signed byte - 0: NONE, -1: NO CONTROLLER, -2: INITIALIZING, -3: INVALID 111 | 112 | 113 | .endif 114 | -------------------------------------------------------------------------------- /.include/melee_modules/_template.s: -------------------------------------------------------------------------------- 1 | .ifndef melee.library.included; .include "melee"; .endif 2 | melee.module MODULE_NAME # --- name your module here 3 | 4 | .if module.included == 0 5 | 6 | 7 | # --- write module contents here 8 | 9 | 10 | .endif 11 | -------------------------------------------------------------------------------- /.include/melee_modules/all.s: -------------------------------------------------------------------------------- 1 | .ifndef melee.library.included; .include "melee"; .endif 2 | melee.module all 3 | 4 | .if module.included == 0 5 | 6 | 7 | melee ppc, common, arch, DVD, GObj, HSDObj, mem, MPad, GX, prim 8 | # load all melee GAS modules 9 | # - this is the default if `melee` is called with no args 10 | 11 | 12 | .endif 13 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/bin/hello.wrl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/.include/melee_modules/arch_resources/bin/hello.wrl -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/bin/mono.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/.include/melee_modules/arch_resources/bin/mono.bmp -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/build/hello_wrl.s: -------------------------------------------------------------------------------- 1 | .include "melee"; melee; punkpc str 2 | 3 | str test_MPad_DUp "example_files/test_MPad/hello_wrl.s" 4 | str test_GProc_data "example_files/test_MPad/data_hello_wrl.s" 5 | # override paths used by test_MPad 6 | 7 | arch example_files/test_MPad/_main.s 8 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/build/test_hax.s: -------------------------------------------------------------------------------- 1 | .include "melee" 2 | punkpc ppc 3 | melee arch 4 | 5 | static_pointer_addr = 0x8040180C # change this to change the pointer location 6 | # - this location is just error message ascii, so it's virtually safe to overwrite 7 | 8 | arch.start # Begin archive wrapper block... 9 | 10 | arch.symbol "init.flush" 11 | .long (1f-0f)>>3 # count 8-byte 12 | 0: 13 | arch.point _instructions_start 14 | arch.point _instructions_end 15 | 1: # this will create range to 'flush' the instruction cache with 16 | 17 | arch.symbol "init.sync" 18 | .long (1f-0f)>>2 # count 4-byte 19 | 0: 20 | arch.point _my_init.sync_callback 21 | 1: # this will cause the included callback to be executed on initialization 22 | 23 | arch.symbol "init.static" 24 | .long (1f-0f)>>3 # count 8-byte 25 | 0: 26 | arch.point static_pointer_addr, _my_data 27 | 1: # this will cause a pointer to internal to be written on initialization 28 | 29 | _instructions_start: 30 | 31 | _my_init.sync_callback: arch "example_files/test_hax_syncCB.s" # emit callback source here... 32 | 33 | _instructions_end: 34 | align 5 # instructions in this region will be flushed 35 | 36 | _my_data: 37 | arch.point _tlut_array_base 38 | arch.point _image 39 | # toc 40 | 41 | _tlut_array_base: .zero 25<<3; align 5 42 | # create blank monochrome RGBA palette slots in the file, to be updated at runtime 43 | 44 | _image: arch.raw "example_files/mono.bmp", 0x3E, 0x2000 45 | # load 0x2000 bytes of pixel data from offset 0x3E of a bitmap file (skipping header) 46 | 47 | arch.end # end of nestable wrapper 48 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_GProc/_main.s: -------------------------------------------------------------------------------- 1 | .include "melee"; melee all; punkpc str 2 | # include all melee modules, and make sure punkpc str objects are available 3 | 4 | # The following ifdef blocks will default to paths given by user before including this file 5 | # - else, they will define the following default paths 6 | ifdef test_GProc_setup.is_str 7 | .if ndef; str test_GProc_setup "example_files/test_GProc/setup.s"; .endif 8 | ifdef test_GProc_data.is_str 9 | .if ndef; str test_GProc_data "example_files/test_GProc/data.s"; .endif 10 | ifdef test_GProc_proc.is_str 11 | .if ndef; str test_GProc_proc "example_files/test_GProc/proc.s"; .endif 12 | 13 | 14 | arch.start 15 | # begin archive wrapper... 16 | 17 | test_GProc_data.str arch # Static data accessed by the GProc goes in this section 18 | # - the path in the str variable is passed over to the arch library object 19 | 20 | _flush_begin: 21 | # this _flush block has its instructions flushed on load, to prevent IC ghosts 22 | # - it allows for safe inclusion of executable instrucitons inside of dynamic memory 23 | 24 | test_GProc_setup.str arch # GObj/GProc setup routine goes here 25 | test_GProc_proc.str arch # GProc goes here 26 | 27 | 28 | _flush_end: 29 | arch.symbol "init.flush" 30 | .long 1 # flush 1 range... 31 | 32 | arch.point _flush_begin, _flush_end 33 | # flush instruction cache between _flush_begin ... _flush_end on initialization 34 | 35 | arch.symbol "init.call" 36 | .long 1 # call 1 callback... 37 | 38 | arch.point _setup 39 | # setup callback will run once "init.flush" has finished 40 | 41 | arch.end 42 | # end of archive wrapper 43 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_GProc/data.s: -------------------------------------------------------------------------------- 1 | _static_data: 2 | 3 | # <-- GObj can reach this data from a pointer at offset 0x0 of its own data table 4 | # - you can include any kind of static parameter you'd want your GProc to use here 5 | # - this data will appear at the beginning of the data section in your archive 6 | 7 | 0: .long 0 8 | align 2 9 | 10 | data.table _static_data 11 | data.struct 0, "data.", xTest 12 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_GProc/proc.s: -------------------------------------------------------------------------------- 1 | _GProc: 2 | 3 | prolog rGObj, rData, rStatic, cr 4 | mr rGObj, r3 # rGObj = the GObj driving this GProc 5 | lwz rData, GObj.xData(rGObj) # rData = GObj instantiated data (in heap) 6 | lwz rStatic, 0x0(rData) # rStatic = static read-only data inside of file 7 | 8 | # <-- write proc here 9 | 10 | _GProc_return: 11 | epilog 12 | blr 13 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_GProc/setup.s: -------------------------------------------------------------------------------- 1 | _setup: 2 | 3 | # this function will execute automatically to setup a GObj when this archive initializes 4 | # - symbols and macros allow for use of some GObj constructor functions 5 | 6 | # The following ifdef blocks will default to inputs given at a higher level, if they exist 7 | # - otherwise, they will define the missing defaults 8 | ifdef test_GProc.Class; .if ndef; test_GProc.Class = GDesc.def.Class; .endif 9 | ifdef test_GProc.PLink; .if ndef; test_GProc.PLink = GDesc.def.PLink; .endif 10 | ifdef test_GProc.PPriority; .if ndef; test_GProc.PPriority = GDesc.def.PPriority; .endif 11 | ifdef test_GProc.DataSize; .if ndef; test_GProc.DataSize = 0x40; .endif 12 | ifdef test_GProc.DataType; .if ndef; test_GProc.DataType = GDesc.def.DataType; .endif 13 | ifdef test_GProc.DataDestr; .if ndef; test_GProc.DataDestr = GObj.HSD_MemFree; .endif 14 | ifdef test_GProc.SPriority; .if ndef; test_GProc.SPriority = GDesc.def.SPriority; .endif 15 | 16 | prolog rArch, rGObj, rGProc 17 | mr rArch, arch.init.call.rArch 18 | addi rGProc, arch.init.call.rSelf, _GProc-_setup 19 | addi rStatic, arch.init.call.rSelf, _static_data-_setup 20 | # save arguments, and use rSelf with _setup label to reach GProc callback, and data 21 | 22 | regs (r3), rClass, rPLink, rPPriority 23 | li rClass, test_GProc.Class 24 | li rPLink, test_GProc.PLink 25 | li rPPriority, test_GProc.PPriority 26 | branchl GObj.new 27 | mr rGObj, r3 28 | # setup a new GObj using generic group/class and low priority (defaults for GDesc) 29 | 30 | .if test_GProc.DataSize 31 | regs (r3), rSize 32 | li rSize, test_GProc.DataSize 33 | branchl GObj.HSD_MemAlloc 34 | # alloc 1kb of memory heap memory 35 | 36 | regs (r3), rThis, rDataType, rDestrCB, rAlloc 37 | mr rAlloc, r3 38 | load rDestrCB, GObj.HSD_MemFree 39 | li rDataType, test_GProc.DataType 40 | mr rThis, rGObj 41 | branchl GObj.data_init 42 | # register alloc to GObj data table 43 | 44 | regs (r3), rAlloc, rSize; data.zero = 0x8000c160 45 | lwz rAlloc, GObj.xData(rGObj) 46 | li rSize, test_GProc.DataSize 47 | branchl data.zero 48 | # zero out GObj property data 49 | 50 | lwz r3, GObj.xData(rGObj) 51 | stw rStatic, 0(r3) 52 | # store pointer to static data in generated GObj data params 53 | 54 | .endif 55 | # only construct data table if a size is given 56 | 57 | regs (r3), rThis, rProcCB, rSPriority 58 | mr rThis, rGObj 59 | mr rProcCB, rGProc 60 | li rSPriority, test_GProc.SPriority 61 | branchl GObj.new_GProc 62 | # register GProc as a process that will run once per frame in this scene 63 | 64 | epilog 65 | blr 66 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_MPad/_main.s: -------------------------------------------------------------------------------- 1 | .include "melee"; melee all; punkpc str 2 | # include all melee modules, and make sure punkpc str objects are available 3 | 4 | # The following ifdef blocks will default to paths given by user before including this file 5 | # - else, they will define the following default paths 6 | ifdef test_GProc_proc.is_str 7 | .if ndef; str test_GProc_proc "example_files/test_MPad/proc.s"; .endif 8 | ifdef test_GProc_data.is_str 9 | .if ndef; str test_GProc_data "example_files/test_MPad/data.s"; .endif 10 | 11 | 12 | # Implement GProc test with the above path modifications 13 | # - DPad paths are used by MPad proc 14 | arch example_files/test_GProc/_main.s 15 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_MPad/data_hello_wrl.s: -------------------------------------------------------------------------------- 1 | _static_data: 2 | 3 | # <-- GObj can reach this data from a pointer at offset 0x0 of its own data table 4 | # - you can include any kind of static parameter you'd want your GProc to use here 5 | # - this data will appear at the beginning of the data section in your archive 6 | 7 | 0: .asciz " Hello %s%s" 8 | 1: .asciz "World" 9 | 2: .asciz "!" 10 | align 2 11 | # for testing a print function, from DPad presses 12 | 13 | data.table _static_data 14 | # data tables anchor "data.struct" offset bases 15 | 16 | data.struct 0, "data.", xTestFormatString, xTestString1, xTestString2 17 | # these names are given to the above enumerated ascii strings 18 | # - they can be used as offset symbols, for reaching the strings with add instructions 19 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_MPad/hello_wrl.s: -------------------------------------------------------------------------------- 1 | regs (r3), rFormatString, rArg1, rArg2; printf = 0x80323eb4 2 | addi rFormatString, rStatic, data.xTestFormatString 3 | addi rArg1, rStatic, data.xTestString1 4 | addi rArg2, rStatic, data.xTestString2 5 | crclr cr1.lt 6 | branchl printf 7 | # print "Hello World!" into the Dolphin log 8 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_MPad/nop.s: -------------------------------------------------------------------------------- 1 | # b _GProc_return 2 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_MPad/proc.s: -------------------------------------------------------------------------------- 1 | punkpc str 2 | 3 | # The default MPad proc only tests onpress DPad buttons: 4 | ifdef test_MPad_DUp.is_str 5 | .if ndef; str test_MPad_DUp "example_files/test_MPad/nop.s"; .endif 6 | ifdef test_MPad_DDown.is_str 7 | .if ndef; str test_MPad_DDown "example_files/test_MPad/nop.s"; .endif 8 | ifdef test_MPad_DLeft.is_str 9 | .if ndef; str test_MPad_DLeft "example_files/test_MPad/nop.s"; .endif 10 | ifdef test_MPad_DRight.is_str 11 | .if ndef; str test_MPad_DRight "example_files/test_MPad/nop.s"; .endif 12 | 13 | _GProc: 14 | prolog rGObj, rMPad, rPress, rData, rStatic, cr 15 | mr rGObj, r3 16 | lwz rData, GObj.xData(rGObj) 17 | lwz rStatic, 0x0(rData) # rStatic = static read-only data inside of file 18 | load rMPad, MPad.Any 19 | lwz rPress, MPad.xOnPress(rMPad) 20 | # saved registers are ready to use 21 | 22 | mtcrf MPad.crf.mDPad, rPress 23 | bt- MPad.bDUp, _DUp 24 | bt- MPad.bDDown, _DDown 25 | bt- MPad.bDLeft, _DLeft 26 | 27 | _DRight: 28 | test_MPad_DRight.str arch 29 | b _GProc_return 30 | 31 | _DLeft: 32 | test_MPad_DLeft.str arch 33 | b _GProc_return 34 | 35 | _DUp: 36 | test_MPad_DUp.str arch 37 | b _GProc_return 38 | 39 | _DDown: 40 | test_MPad_DDown.str arch 41 | b _GProc_return 42 | 43 | _GProc_return: 44 | epilog 45 | blr 46 | -------------------------------------------------------------------------------- /.include/melee_modules/arch_resources/example_files/test_hax_syncCB.s: -------------------------------------------------------------------------------- 1 | prolog 2 | -------------------------------------------------------------------------------- /.include/melee_modules/ppc.s: -------------------------------------------------------------------------------- 1 | .ifndef melee.library.included; .include "melee"; .endif 2 | melee.module ppc 3 | 4 | .if module.included == 0 5 | 6 | 7 | punkpc ppc 8 | # load punkpc powerpc symbols and macros 9 | # - this includes several prereq punkpc modules, including enum, strings, and stack objects 10 | 11 | 12 | .endif 13 | -------------------------------------------------------------------------------- /.include/punkpc.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .ifndef punkpc.module.version 3 | .include "punkpc/library.s" 4 | .endif 5 | module.library punkpc, ".s", ppc 6 | .endif 7 | punkpc.maindir "punkpc/" 8 | punkpc.subdir "", ".s" 9 | -------------------------------------------------------------------------------- /.include/punkpc/README.md: -------------------------------------------------------------------------------- 1 | See the punkpc documentation for more details -- https://github.com/Punkline/punkpc 2 | -------------------------------------------------------------------------------- /.include/punkpc/align.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module align, 1 3 | .if module.included == 0; punkpc ifalt;_align.__start = _punkpc;align.default = 2 4 | .macro align, exp=align.default; align.to \exp 5 | .endm;.macro align.to, exp, lab=_align.__start; align.__altm = alt;ifalt;align.__alt = alt 6 | .noaltmacro;align.__noalt (\exp & 0xF), \lab;ifalt.reset align.__alt;alt = align.__altm 7 | .endm;.macro align.__noalt, exp, lab; align.__exp = 1 << \exp - 1 8 | align.__exp = (align.__exp - (. - \lab - 1) & align.__exp) 9 | .if align.__exp; .zero align.__exp;.endif; 10 | .endm;.endif; 11 | 12 | -------------------------------------------------------------------------------- /.include/punkpc/bcount.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module bcount, 2 3 | .if module.included == 0 4 | .macro bcount.zbe, i, rtrn=bcount; bcount = 0;bcount.int = \i;bcount.len = 32 5 | .if !bcount.int; bcount = 32 6 | .else; .rept 5; bcount.len = bcount.len >> 1 7 | .if !(bcount.int >> (32-bcount.len)) 8 | bcount.int = bcount.int << bcount.len 9 | bcount = bcount + bcount.len;.endif;.endr;.endif;\rtrn = bcount 10 | .endm;.macro bcount.zle, i, rtrn=bcount; bcount = 0;bcount.int = \i;bcount.len = 32 11 | .if !bcount.int; bcount = 32 12 | .else; .rept 5; bcount.len = bcount.len >> 1 13 | .if !(bcount.int << (32-bcount.len)) 14 | bcount.int = bcount.int >> bcount.len 15 | bcount = bcount + bcount.len;.endif;.endr;.endif;\rtrn = bcount 16 | .endm;.macro bcount.be, i, rtrn=bcount; bcount.zle \i;bcount = 32-bcount;\rtrn = bcount 17 | .endm;.macro bcount.le, i, rtrn=bcount; bcount.zbe \i;bcount = 32-bcount;\rtrn = bcount 18 | .endm;.macro bcount, i, rtrn=bcount; bcount.zbe \i;bcount = 32-bcount;\rtrn = bcount 19 | .endm;.macro bcount.signed, i, rtrn=bcount; bcount.sign = \i>>31 20 | .if (\i==-1)||(\i==0); bcount = 2 21 | .else; .if bcount.sign; bcount.le ~\i 22 | .else; bcount.le \i;.endif;bcount=bcount+1;.endif;\rtrn = bcount 23 | .endm;.macro bcount.zsigned, i, rtrn=bcount; bcount.signed \i;bcount = 32 - bcount 24 | \rtrn = bcount 25 | .endm;.endif; 26 | 27 | -------------------------------------------------------------------------------- /.include/punkpc/branch.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module branch, 3 3 | .if module.included == 0 4 | .ifndef branchl.purgem; branchl.purgem = 0;.endif; 5 | .if branchl.purgem; branchl.purgem = 0;.purgem branch;.purgem branchl;.endif; 6 | .irp x, branchl, branch, bla, ba 7 | .irp y, .purgem; \x\y = 1;.endr;.endr; 8 | .macro bla, a, b 9 | .ifb \b 10 | lis r0, \a @h 11 | ori r0, r0, \a @l 12 | mtlr r0 13 | blrl;.else; 14 | lis \a, \b @h 15 | ori \a, \a, \b @l 16 | mtlr \a 17 | blrl;.endif; 18 | .endm;.macro ba, a, b 19 | .ifb \b 20 | lis r0, \a @h 21 | ori r0, r0, \a @l 22 | mtctr r0 23 | bctr;.else; 24 | lis \a, \b @h 25 | ori \a, \a, \b @l 26 | mtctr \a 27 | bctr;.endif; 28 | .endm;.irp l, l, , 29 | .macro branch\l, va:vararg; b\l\()a \va 30 | .endm;.endr;.endif; 31 | 32 | -------------------------------------------------------------------------------- /.include/punkpc/cr.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module cr, 1 3 | .if module.included == 0; punkpc enum, regs 4 | .macro cr.__build_set_clr, cr, re 5 | .macro \cr, d, va:vararg; \re \d, \d, \d 6 | .endm;.endm;.macro cr.enable_overrides 7 | .if cr.enable_overrides == 0; cr.enable_overrides = 1;cr.__build_set_clr crset, crorc 8 | cr.__build_set_clr crclr, crandc;.endif; 9 | .endm;.macro cr.disable_overrides 10 | .if cr.enable_overrides; cr.enable_overrides = 0;.purgem crset;.purgem crclr;.endif; 11 | .endm;cr.enable_overrides = 0;cr.enable_overrides;.endif 12 | 13 | -------------------------------------------------------------------------------- /.include/punkpc/data.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module data, 3 3 | .if module.included == 0; punkpc if, sidx, hex;data.start.inline = 1;data.start.use_blrl = 1 4 | data.base_reg = 12 5 | .ifndef punkpc.data.custom_namespace 6 | .macro data.table, name, loc; punkpc.data.table \name, \loc 7 | .endm;.macro data.start, name, loc; punkpc.data.start \name, \loc 8 | .endm;.macro data.end, reg; punkpc.data.end \reg 9 | .endm;.macro data.get, reg, keyword, base_reg 10 | punkpc.data.get \reg, \keyword, \base_reg 11 | .endm;.macro data.foot, va:vararg; punkpc.data.foot \va 12 | .endm;.macro data.struct, idx, struct_pfx, names:vararg 13 | punkpc.data.struct \idx, \struct_pfx, \names 14 | .endm;.endif;punkpc.data.loc = .;punkpc.data.idx = 0;punkpc.data.endlabels$ = 0 15 | .macro punkpc.data.loc, label; punkpc.data.loc = \label 16 | .endm;.macro punkpc.data.loc.update, loc; punkpc.data.loc.type = 0 17 | .ifc \loc, .; punkpc.data.loc = .;.exitm;.endif;ifnum \loc 18 | .if num; punkpc.data.loc.type = 1 19 | .irpc c, \loc; num=1 20 | .ifc \c, f; num=0;.endif; 21 | .ifc \c, b; num=0;.endif;.endr; 22 | .if num; punkpc.data.loc.type = 2 23 | .if punkpc.data.endlabels$; punkpc.data.loc \loc\()f 24 | .else; punkpc.data.loc.type = 3;punkpc.data.loc \loc\()b;.endif; 25 | .else; punkpc.data.loc.type = 4' punkpc.data.loc = \loc;.endif; 26 | .else; ifdef _data.table$\loc 27 | .if def; punkpc.data.loc.type = 5;punkpc.data.loc = _data.table$\loc 28 | .else; ifdef \loc 29 | .if def; punkpc.data.loc.type = 6;punkpc.data.loc = \loc 30 | .else; punkpc.data.loc.type = 7;punkpc.data.loc = _data.table$\loc;.endif;.endif; 31 | .endif; 32 | .endm;.macro punkpc.data.table, name, loc 33 | .ifb \loc; punkpc.data.loc.update \name 34 | .if punkpc.data.loc.type == 7; punkpc.data.loc = .;.endif; 35 | .else; punkpc.data.loc.update \loc;.endif; 36 | .ifb \name; _data.table = punkpc.data.loc 37 | .else; punkpc.data.table.update \name;.endif; 38 | .endm;.macro punkpc.data.table.update, name=start; ifdef _data.table$\name 39 | .if ndef; _data.table$\name = .;.endif;_data.table$\name = punkpc.data.loc 40 | _data.table = _data.table$\name 41 | .endm;.macro punkpc.data.start, name=start, loc 42 | .ifb \loc 43 | .if data.start.inline; sidx.get _data.end, punkpc.data.endlabels$ + 1 44 | _data.end = sidx 45 | b _data.end;.endif; 46 | .if data.start.use_blrl 47 | blrl;.endif;_data.table$start = .;punkpc.data.table start;.endif; 48 | punkpc.data.table \name, \loc;_data.start = _data.table 49 | .endm;.macro punkpc.data.end, reg; punkpc.data.endlabels$ = punkpc.data.endlabels$ + 1 50 | sidx = .;sidx.set _data.end, punkpc.data.endlabels$ 51 | .ifnb \reg; punkpc.data.get \reg;.endif; 52 | .endm;.macro punkpc.data.foot, name=foot, loc; data.start.inline = 0 53 | .if punkpc.data.endlabels$; data.start.use_blrl = 0;.endif;punkpc.data.start \name, \loc 54 | .endm;.macro punkpc.data.get, reg, keyword, base_reg=data.base_reg 55 | .ifb \keyword 56 | bl _data.start - 4 57 | .ifnb \reg; data.base_reg = \reg 58 | mflr \reg;.endif; 59 | .else; punkpc.data.loc.update \keyword 60 | addi \reg, \base_reg, punkpc.data.loc - _data.start;.endif; 61 | .endm;.macro punkpc.data.struct, idx=punkpc.data.idx, pfx, names:vararg 62 | .ifnb \pfx\names; punkpc.data.idx = \idx - 1;punkpc.data.altm = alt;ifalt 63 | punkpc.data.alt = alt;.altmacro 64 | .irp name, \names 65 | .ifnb \name; punkpc.data.idx = punkpc.data.idx + 1 66 | .if punkpc.data.idx == \idx; _data.struct = .;.endif; 67 | punkpc.data.struct.eval %punkpc.data.idx, \pfx\name;.endif;.endr; 68 | ifalt.reset punkpc.data.alt;alt = punkpc.data.altm 69 | .else; _data.struct = .;\idx = _data.struct - _data.table;.endif; 70 | .endm;.macro punkpc.data.struct.eval, i, s 71 | punkpc.data.struct.assign \s, \i\()b - _data.table 72 | .endm;.macro punkpc.data.struct.assign, s, e; \s = \e 73 | .endm;.endif; 74 | 75 | -------------------------------------------------------------------------------- /.include/punkpc/dbg.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module dbg, 2 3 | .if module.included == 0 4 | .macro dbg, i, x 5 | .ifb \x; .altmacro;dbg %\i, \i;.noaltmacro 6 | .else; .warning "\x = \i";.endif; 7 | .endm;.endif; 8 | 9 | -------------------------------------------------------------------------------- /.include/punkpc/en.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module en, 0x100 3 | .if module.included == 0 4 | .macro en, va:vararg 5 | .irp sym, \va 6 | .ifnb \sym 7 | .irpc c, \sym 8 | .ifc \c, (; en.count=\sym;.exitm;.endif; 9 | .ifc \c, +; en.step=\sym;.exitm;.endif; 10 | .ifc \c, -; en.step=\sym;.exitm;.endif;\sym=en.count 11 | en.count=en.count+en.step;.exitm;.endr;.endif;.endr; 12 | .endm;.macro en.restart; en.count = en.count.restart;en.step = en.step.restart 13 | .endm;.macro en.save, dict; \dict\().count = en.count;\dict\().step = en.step 14 | .endm;.macro en.load, dict; en.count = \dict\().count;en.step = \dict\().step 15 | .endm;en.count.restart = 0;en.step.restart = 1;en.restart;.endif 16 | 17 | -------------------------------------------------------------------------------- /.include/punkpc/enc.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module enc, 1 3 | .if module.included == 0; punkpc stack, if;enc.__char = 0;enc.__skip = 0;enc.__exit = 0 4 | enc.__escaping = 0;enc.__encode_raw = 0;stack enc.__escaped 5 | .macro enc.new, self, st=0, en=-1; stack \self 6 | .if obj.ndef; \self\().enc_start = \st;\self\().enc_end = \en 7 | .macro \self\().enc, str:vararg; enc.__encode_raw = 0 8 | enc.__encode \self, \self\().enc_start, \self\().enc_end, \str 9 | .endm; 10 | .macro \self\().enc_range, start=\self\().enc_start, end=\self\().enc_end, str:vararg 11 | enc.__encode_raw = 0;enc.__encode \self, \start, \end, \str 12 | .endm; 13 | .macro \self\().enc_raw, start=\self\().enc_start, end=\self\().enc_end, str:vararg 14 | enc.__encode_raw = 1;enc.__encode \self, \start, \end, "\str" 15 | .endm;.endif; 16 | .endm;.macro enc.__encode, self, start, end, str:vararg; ifalt;enc.__encode.alt = alt 17 | .noaltmacro;enc.__escaping = 0;enc.__escapes = 0;enc.__quotes = 0;enc.__skip = 0 18 | enc.__index = 0;enc.__exit = 0 19 | .irpc c, \str 20 | .if enc.__index >= \start 21 | enc.__encode.char "'\c+1", "\c " 22 | .if enc.__escaping == 0 23 | .if enc.__skip == 0; \self\().push enc.__char;.endif; 24 | .if enc.__exit; .exitm;.endif; 25 | .if enc.__skip > 0 26 | enc.__skip = enc.__skip - 1;.endif;.endif;.endif;enc.__index = enc.__index + 1 27 | .if enc.__index == \end; enc.__exit = 1;.endif;.endr;ifalt.reset enc.__encode.alt 28 | .endm;.macro enc.__encode.char, i, va:vararg; enc.__char = \i-1 29 | .if enc.__escaping < 0 30 | enc.__escaping = 0;.endif; 31 | .if enc.__escaping; enc.__escape 32 | .elseif enc.__char == 451; enc.__escaping = -!enc.__encode_raw;enc.__char = 0x22 33 | enc.__quotes=enc.__quotes + 1 34 | .elseif enc.__char == 430; enc.__escaping = !enc.__encode_raw;enc.__char = 0x4C 35 | enc.__escapes=enc.__escapes + 1;.endif; 36 | .endm;.macro enc.__escape 37 | .if enc.__escaping == 1; enc.__escape.beg 38 | .elseif enc.__escaping <= 4; 39 | enc.__escape.oct;.elseif enc.__escaping <= 7; 40 | enc.__escape.dec;.elseif enc.__escaping <= 9; 41 | enc.__escape.hex;.else; enc.__escaping = 0;.endif; 42 | .endm;.macro enc.__escape.beg 43 | .if enc.__char == 451; enc.__escaping = 0;enc.__char = 0x22 44 | .elseif enc.__char == 430; enc.__escaping = 0;enc.__char = 0x5C 45 | .elseif (enc.__char >= 0x30) && (enc.__char <= 0x37); 46 | enc.__escaping = 2;enc.__escape 47 | .elseif enc.__char == 0x64; enc.__escaping = 5 48 | .elseif enc.__char == 0x78; enc.__escaping = 8 49 | .elseif enc.__char == 0x74; enc.__escaping = 0;enc.__char = 0x9 50 | .elseif enc.__char == 0x72; enc.__escaping = 0;enc.__char = 0xD 51 | .elseif enc.__char == 0x6E; enc.__escaping = 0;enc.__char = 0xA 52 | .else; enc.__escaping = 0;.endif; 53 | .endm;.macro enc.__escape.oct; enc.__escaping = enc.__escaping + 1 54 | .if (enc.__char >= 0x30) && (enc.__char <= 0x37) 55 | enc.__escaped.push enc.__char & 7 56 | .if enc.__escaping >= 5 57 | enc.__escaping = 0;.endif; 58 | .else; enc.__escaping = 0;.endif; 59 | .if enc.__escaping == 0; enc.__char = 0 60 | .rept enc.__escaped.s; enc.__escaped.deq enc.__escaped 61 | enc.__char = enc.__char << 3 | enc.__escaped 62 | .endr;.endif; 63 | .endm;.macro enc.__escape.dec; enc.__escaping = enc.__escaping + 1 64 | .if (enc.__char >= 0x30) && (enc.__char <= 0x39) 65 | enc.__escaped.push enc.__char & 15 66 | .if enc.__escaping >= 8 67 | enc.__escaping = 0;.endif; 68 | .else; enc.__escaping = 0;.endif; 69 | .if enc.__escaping == 0; enc.__char = 0 70 | .rept enc.__escaped.s; enc.__escaped.deq enc.__escaped 71 | enc.__char = enc.__char * 10 + enc.__escaped;.endr;.endif; 72 | .endm;.macro enc.__escape.hex; enc.__escaping = enc.__escaping + 1 73 | .if (enc.__char >= 0x30) && (enc.__char <= 0x39) 74 | enc.__escaped.push (enc.__char & 15);.else; enc.__char = enc.__char - 0x37 75 | .if (enc.__char >= 10) && (enc.__char <= 15) 76 | enc.__escaped.push enc.__char;.else; enc.__char = enc.__char - 0x20 77 | .if (enc.__char >= 10) && (enc.__char <= 15) 78 | enc.__escaped.push enc.__char;.else; enc.__escaping = 0;.endif;.endif;.endif; 79 | .if enc.__escaping >= 10 80 | enc.__escaping = 0;.endif; 81 | .if enc.__escaping == 0; enc.__char = 0 82 | .rept enc.__escaped.s; enc.__escaped.deq enc.__escaped 83 | enc.__char = enc.__char << 4 | enc.__escaped 84 | .endr;.endif; 85 | .endm;.endif; 86 | 87 | -------------------------------------------------------------------------------- /.include/punkpc/enum.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module enum, 0x202 3 | .if module.included == 0; punkpc obj, en;enum.uses_mutators = 1;obj.class enum 4 | enum.uses_pointers = 1;enum.self_pointers = 0;enum.count_default = 0;enum.step_default = 1 5 | enumb.count_default = 31;enumb.step_default = -1 6 | .macro enum.new_raw, self, prefix, suffix, varg:vararg; enum.obj \self 7 | .if obj.ndef; \self\().enum_exiting = 0;enum.purge_hook \self, enum_parse 8 | enum.meth \self, restart;\self\().mut, enum_parse_iter, restart 9 | .macro \self, va:vararg; enum.mut.enum_conc.default \self, \prefix, \suffix, \va 10 | .endm;.endif; 11 | .endm;.macro enum.new_generic, self, prefix, suffix, varg:vararg 12 | enum.new_raw \self, \prefix, \suffix 13 | .if obj.ndef; \self\().count.restart = 0;\self\().step.restart = 1 14 | \self\().count = enum.count_default;\self\().step = enum.step_default 15 | \self\().steps = 0;\self\().last = 0 16 | enum.purge_hook \self, enum_parse_iter, numerical, count, step, restart 17 | \self\().mut, literal;.endif; 18 | .endm;.macro enum.new, self, prefix, suffix, va:vararg 19 | enum.new_generic \self, \prefix, \suffix 20 | .if obj.ndef; \self \va;\self\().step.restart = \self\().step 21 | \self\().count.restart = \self\().count;\self\().count = enum.count_default 22 | \self\().step = enum.step_default;enum.purge_hook \self, literal;\self \va;.endif; 23 | .endm;.macro enumb.new, self, prefix, suffix, varg:vararg 24 | enum.new_generic \self, \prefix, \suffix 25 | .if obj.ndef; \self\().mask = 0;\self\().crf = 0;\self\().mode count, bool 26 | \self\().count = enumb.count_default;\self\().step = enumb.step_default;\self \varg 27 | \self\().step.restart = \self\().step;\self\().count.restart = \self\().count 28 | enum.purge_hook \self, mask;\self\().mode literal, bool 29 | \self\().count = enumb.count_default;\self\().step = enumb.step_default;\self \varg 30 | .macro \self\().mask, va:vararg 31 | mut.call \self, mask, default, enum, , , \prefix, \suffix, \va 32 | .endm;.endif; 33 | .endm;.macro enum.__enum_conc.mut.call, self, pfx, sfx, arg 34 | mut.call \self, enum_parse_iter, default, enum, , , \pfx\arg\sfx, \pfx, \sfx, \arg 35 | .endm;enum.meth, enum_parse, enum_parse_iter, numerical, literal, count, step, mask 36 | .macro enum.mut.enum_conc.default, self, va:vararg; ifalt;enum.ifalt = alt;.noaltmacro 37 | mut.call \self, enum_parse, default, enum, , , \va;ifalt.reset enum.ifalt 38 | .endm;.macro enum.mut.enum_parse.default, self, pfx, sfx, va:vararg 39 | .irp arg, \va; \self\().enum_exiting = 0 40 | .ifnb \arg; enum.__enum_conc.mut.call \self, \pfx, \sfx, \arg 41 | .if \self\().enum_exiting > 0 42 | \self\().enum_exiting = \self\().enum_exiting -1 43 | .if \self\().enum_exiting == 0; .exitm;.endif;.endif;.endif;.endr; 44 | .endm;.macro enum.mut.enum_parse_iter.default, self, sym, pfx, sfx, arg, va:vararg 45 | ifnum_ascii \arg 46 | .if num; mut.call \self, numerical, default, enum, , , \arg, num, \pfx, \sfx, \va 47 | .else; mut.call \self, literal, default, enum, , , \sym, \pfx, \sfx, \arg, \va;.endif; 48 | .endm;.macro enum.mut.numerical.default, self, arg, char, va:vararg 49 | .if \char == 0x28; mut.call \self, count, default, enum, , , \arg, \va 50 | .elseif \char >= 0x30; .if \char <= 0x39 51 | mut.call \self, count, default, enum, , , \arg, \va;.endif; 52 | .elseif \char == 0x2B; mut.call \self, step, default, enum, , , \arg, \va 53 | .elseif \char == 0x2D; mut.call \self, step, default, enum, , , \arg, \va;.endif; 54 | .endm;.macro enum.mut.literal.default, self, arg, va:vararg; \arg = \self\().count 55 | mut.call \self, count, default, enum, , , \self\().count + \self\().step 56 | \self\().steps = \self\().steps + 1 57 | .endm;.macro enum.mut.count.default, self, arg, va:vararg; \self\().last = \self\().count 58 | \self\().count = \arg 59 | .endm;.macro enum.mut.step.default, self, arg, va:vararg; \self\().step = \arg 60 | .endm;.macro enum.mut.restart.default, self, va:vararg 61 | \self\().step = \self\().step.restart;\self\().count = \self\().count.restart 62 | .endm;.macro enum.mut.mask.default, self, pfx, sfx, va:vararg 63 | .irp arg, \va 64 | .ifnb \arg 65 | .irp conc, m\arg\sfx; enum.__bool_mask \self, \pfx\arg\sfx, \pfx\conc;.endr;.endif; 66 | .endr; 67 | .endm;.macro enum.__bool_mask, self, arg, mask, va:vararg; ifnum \arg 68 | .if nnum; ifdef \arg 69 | .if ndef; \arg = 0;.endif; 70 | .if \arg; \self\().mask = \self\().mask | \mask;enum.__crf_index = \arg >> 2 71 | \self\().crf = \self\().crf | (1 << enum.__crf_index) & 0xFF;.endif;.endif; 72 | .endm;.macro enum.mut.literal.bool, self, sym, pfx, sfx, arg, va:vararg 73 | \pfx\()b\arg\sfx = \self\().count & 0x1F 74 | mut.call \self, count, bool, enum, , , \self\().count + \self\().step 75 | \pfx\()m\arg\sfx = 0x80000000 >> \pfx\()b\arg\sfx 76 | \self\().steps = \self\().steps + 1;.endm; 77 | .macro enum.mut.count.bool, self, arg, va:vararg; \self\().last = \self\().count 78 | \self\().count = \arg & 0x1F 79 | .endm;.macro enum.mut.numerical.relative, self, arg, char, va:vararg 80 | .if \char == 0x28; mut.call \self, count, default, enum, , , \self\().count + \arg, \va 81 | .elseif \char >= 0x30; .if \char <= 0x39 82 | mut.call \self, count, default, enum, , , \self\().count + \arg, \va;.endif; 83 | .elseif \char == 0x2B; mut.call \self, step, default, enum, , , \arg, \va 84 | .elseif \char == 0x2D; mut.call \self, step, default, enum, , , \arg, \va;.endif; 85 | .endm;.macro enum.mut.enum_parse_iter.quick, self, arg, va:vararg; \arg=\self\().count 86 | \self\().count = \self\().count + \self\().step 87 | .endm;enum.new enum.temp;enumb.new enumb.temp, , , -1, (31) 88 | .macro enum, va:vararg; enum.enum_conc, , \va 89 | .endm;.macro enum.enum_conc, va:vararg 90 | .irp p, last, count, step, steps; enum.temp.\p = enum.\p;.endr; 91 | enum.mut.enum_conc.default enum.temp, \va 92 | .irp p, last, count, step, steps; enum.\p = enum.temp.\p;.endr; 93 | .endm;.macro enum.restart, self, va:vararg 94 | .ifb \self 95 | .irp p, restart.count, restart.step; enum.temp.\p = enum.\p;.endr;enum.temp.restart 96 | .irp p, count, step; enum.\p = enum.temp.\p;.endr; 97 | .else; enum.call_mut \self, restart, default, \va;.endif; 98 | .endm;.macro enumb, va:vararg; enumb.enum_conc, , \va 99 | .endm;.macro enumb.enum_conc, va:vararg 100 | .irp p, last, count, step, steps; enumb.temp.\p = enumb.\p;.endr; 101 | enum.mut.enum_conc.default enumb.temp, \va 102 | .irp p, last, count, step, steps; enumb.\p = enumb.temp.\p;.endr; 103 | .endm;.macro enumb.restart 104 | .irp p, count.restart, step.restart; enumb.temp.\p = enumb.\p;.endr;enumb.temp.restart 105 | .irp p, count, step; enumb.\p = enumb.temp.\p;.endr; 106 | .endm;.macro enumb.mask, va:vararg 107 | .irp p, mask, crf; enumb.temp.\p = enumb.\p;.endr;enumb.temp.mask \va 108 | .irp p, mask, crf; enumb.\p = enumb.temp.\p;.endr; 109 | .endm;.irp p, last, count, step, steps, count.restart, step.restart 110 | enum.\p = enum.temp.\p;enumb.\p = enumb.temp.\p;.endr;enumb.mask = 0;enumb.crf = 0 111 | punkpc regs;.endif 112 | 113 | -------------------------------------------------------------------------------- /.include/punkpc/errata.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module errata, 1 3 | .if module.included == 0; punkpc obj, sidx, if;errata.uses_mutators = 1;errata.uses_pointers = 1 4 | errata.self_pointers = 1;errata.uses_obj_mut_methods = 0;obj.class errata 5 | .macro errata.new, self, va:vararg 6 | .ifnb \self; errata.obj \self 7 | .if obj.ndef; errata.meth \self, ref, solve 8 | errata.purge_hook \self, ref_iter, solve_iter;\self\().i = 0;\self\().__val = 0 9 | .endif;errata.new \va;.endif; 10 | .endm;.macro errata.mut.ref.default, va:vararg; errata.__loop ref_iter, \va 11 | .endm;.macro errata.mut.solve.default, va:vararg; errata.__loop solve_iter, \va 12 | .endm;.macro errata.mut.ref_iter.default, self, arg, va:vararg; ifnum \arg 13 | .if num; errata.__i = errata.__i - 1;\self\().i = \arg 14 | .else; sidx.noalt "<\arg = \self>", \self\().i + errata.__i 15 | .endif;.endm;.macro errata.mut.solve_iter.default, self, arg, va:vararg; ifnum_ascii \arg 16 | .if num == '[; errata.__i = errata.__i - 1;\self\().i = \arg 17 | .else; \self\().__val = \arg 18 | sidx.noalt "<\self>", \self\().i + errata.__i, "< = \self\().__val>" 19 | .endif;.endm;.macro errata.mut.solve_iter.stack, self, va:vararg 20 | errata.mut.solve_iter.default \self, \va 21 | .if num != '[; errata.__i = errata.__i - 1;\self\().i = \self\().i + 1;.endif; 22 | .endm;errata.meth, ref, solve 23 | .macro errata.__loop, meth, self, va:vararg; errata.__i = 0;errata.__altm = alt;ifalt 24 | errata.__alt = alt;.noaltmacro 25 | .irp arg, \va 26 | .ifnb \arg; errata.call_mut \self, \meth, default, \arg;.endif; 27 | errata.__i = errata.__i + 1;.endr;ifalt.reset errata.__alt;alt = errata.__altm 28 | .endm;.endif; 29 | 30 | -------------------------------------------------------------------------------- /.include/punkpc/gecko.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module gecko, 1 3 | .if module.included == 0; punkpc errata, align, if;errata.new gecko.block;gecko.block.__open = 0 4 | .macro gecko.inj, address; gecko.end;gecko.block.__open = 1;gecko.block.ref gecko.__size 5 | .long 0xC2000000 | (0x01FFFFFF & \address), gecko.__size;gecko.__start = . 6 | .endm;.macro gecko.ovw, address, va:vararg; gecko.end;gecko.__altm = alt;ifalt 7 | gecko.__alt = alt;gecko.__target = \address - 4;gecko.__quote = 0;.noaltmacro 8 | gecko.__ovw, \va;ifalt.reset gecko.__alt;alt = gecko.__altm 9 | .endm;.macro gecko.__ovw, arg, va:vararg 10 | .ifnb \arg; .long 0x04000000 | (0x01FFFFFF & gecko.__target) 11 | .if gecko.__quote; \arg 12 | .else; .long \arg;.endif;.endif;gecko.__target = gecko.__target + 4 13 | .ifnb \va; .altmacro;gecko.__ovw_alt \va;.noaltmacro 14 | .if gecko.__quote; gecko.__ovw \va 15 | .else; gecko.__ovw_check \va 16 | .if num; gecko.__ovw \va 17 | .else; gecko.__ovw_va \va;.endif;.endif;.endif; 18 | .endm;.macro gecko.__ovw_alt, arg, va:vararg; gecko.__i = 0;gecko.__quote = 0 19 | .irpc c, <\arg> 20 | .if gecko.__i 21 | .ifc \c\c, ""; gecko.__quote = 1;.endif;.exitm 22 | .else; gecko.__i = 1;.endif;.endr; 23 | .endm;.macro gecko.__ovw_check, arg, va:vararg; ifnum \arg 24 | .endm;.macro gecko.__ovw_va, va:vararg 25 | .ifnb \va; .long 0x04000000 | (0x01FFFFFF & gecko.__target);\va;.endif; 26 | .endm;.macro gecko.end 27 | .if gecko.block.__open; gecko.block.__open = 0 28 | .if (. - gecko.__start) & 7; .long 0 29 | .else; 30 | nop;.long 0;.endif;gecko.size = (. - gecko.__start)>>3 31 | gecko.block.solve gecko.size;gecko.block.i = gecko.block.i + 1;.endif; 32 | .endm;.macro gecko, a, b:vararg 33 | .ifnb \a 34 | .ifnb \b; gecko.ovw \a, \b 35 | .else; gecko.inj \a;.endif; 36 | .else; gecko.end;.endif; 37 | .endm;.endif; 38 | 39 | -------------------------------------------------------------------------------- /.include/punkpc/hex.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module hex, 1 3 | .if module.included == 0; punkpc enc, align 4 | .macro hex.new, self, va:vararg 5 | .ifnb \self; enc.new \self 6 | .if obj.ndef; stack.purge_hook \self, hex, emit, read;stack.meth \self, emit, read 7 | .macro \self, varg:vararg; stack.call_mut \self, hex, default, \varg 8 | .endm;\self\().mode push, hex;\self\().i = 0;\self\().emit = 0 9 | \self\().read_size = 1;\self\().__nib = 0;\self\().__byte = 0;\self\().__align = 0 10 | \self\().__pushing_hex = 0;.endif;.endif; 11 | .endm;.macro stack.mut.hex.default, self, va:vararg; \self\().__pushing_hex = 1 12 | \self\().i = \self\().s;hex.__altm = alt;ifalt;hex.__alt = alt;.noaltmacro 13 | .ifnb \va; \self\().enc_raw 0, -1, \va;.endif;hex.__flush_escaped \self 14 | ifalt.reset hex.__alt;alt = hex.__altm;\self\().__pushing_hex = 0 15 | .if \self\().emit; \self\().emit \self\().i;.endif; 16 | .endm;.macro stack.mut.read.default, self, idx, va:vararg; hex.__idx = \idx 17 | .if \self\().read_size > 4 18 | \self\().read_size = 4;.elseif \self\().read_size < 1; 19 | \self\().read_size = 1;.endif;hex.__size = \self\().read_size 20 | .irp sym, \va 21 | .ifnb \sym; hex.__read = 0 22 | sidx.rept \self, hex.__idx, hex.__size+hex.__idx-1, hex.__read_byte 23 | \sym = hex.__read;hex.__idx = hex.__idx + hex.__size;.endif;.endr; 24 | .endm;.macro hex.__read_byte, arg; hex.__read = (hex.__read << 8) | \arg 25 | .endm;.macro stack.mut.emit.default, self, beg, end, macro=.byte, va:vararg 26 | .ifb \beg; hex.__emit_beg = \self\().q 27 | .else; hex.__emit_beg = \beg;.endif; 28 | .ifb \end; hex.__emit_end = \self\().s-1 29 | .else; hex.__emit_end = \end;.endif; 30 | stack.rept_range \self, hex.__emit_beg, hex.__emit_end, \macro 31 | .endm;.macro stack.mut.push.hex, self, char, va:vararg 32 | .if \self\().__pushing_hex == 0; stack.mut.push.default \self, \char, \va;.exitm;.endif; 33 | .if \self\().__pushing_hex == 1 34 | .if \char == 0x30; \self\().__pushing_hex = 2 35 | .else; hex.__check_escape \self, \char;.endif; 36 | .else; hex.__escaping \self, \char;.endif; 37 | .endm;.macro hex.__flush_escaped, self 38 | .if \self\().__pushing_hex == 2; hex.__check_escape \self, 0x30 39 | .elseif \self\().__pushing_hex == 3; .if hex.__align > 1 40 | hex.__align = (1<<(hex.__align-1)) 41 | hex.__align = (hex.__align - \self\().s) & (hex.__align-1) 42 | .rept hex.__align; stack.mut.push.default \self, 0;.endr;.endif;.endif; 43 | \self\().__pushing_hex = 1;hex.__align = 0 44 | .endm;.macro hex.__check_escape, self, char 45 | .if (enc.__quotes & 1); \self\().__pushing_hex = 4 46 | .elseif \char == 0x2E; hex.__escape_dot \self 47 | .elseif ((\char >= 0x30) && (\char <= 0x39)); 48 | hex.__nibble \self, \char - 0x30;.elseif ((\char >= 0x41) && (\char <= 0x46)); 49 | hex.__nibble \self, \char - 0x37;.elseif ((\char >= 0x61) && (\char <= 0x66)); 50 | hex.__nibble \self, \char - 0x57;.endif; 51 | .endm;.macro hex.__nibble, self, val; \self\().__byte = (\self\().__byte << 4) | (\val) 52 | .if \self\().__nib; stack.mut.push.default \self, (\self\().__byte & 0xFF);.endif; 53 | \self\().__nib = \self\().__nib ^ 1 54 | .endm;.macro hex.__escaping, self, char 55 | .if \self\().__pushing_hex == 2 56 | .if ((\char == 0x78) || (\char == 0x58)); \self\().__pushing_hex = 1 57 | .else; hex.__flush_escaped \self 58 | .if \char == 0x30; \self\().__pushing_hex = 2 59 | .else; hex.__check_escape \self, \char;.endif;.endif; 60 | .elseif \self\().__pushing_hex == 3; .if \char == 0x2E; hex.__escape_dot \self 61 | .else; hex.__flush_escaped \self;.endif; 62 | .elseif \self\().__pushing_hex == 4; .if (enc.__quotes & 1) 63 | stack.mut.push.default \self, \char 64 | .else; \self\().__pushing_hex = 1;.endif;.endif; 65 | .endm;.macro hex.__escape_dot, self 66 | .if \self\().__align < 6 67 | \self\().__align = \self\().__align + 1;.endif;\self\().__pushing_hex = 3 68 | .if \self\().__align == 1 69 | .if \self\().__nib; hex.__nibble \self, 0;.endif;.endif; 70 | .endm;.macro hex.__escape_quote, self; .endm;hex.new hex;hex.emit = 1;.endif 71 | 72 | -------------------------------------------------------------------------------- /.include/punkpc/hidden.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module hidden, 1 3 | .if module.included == 0; hidden = 0;hidden.count = 0 4 | .macro hidden, pfx, sfx, m, va:vararg; hidden.count = hidden.count + 1 5 | .ifnb \va; \m \pfx\()\sfx, \va 6 | .else; \m \pfx\()\sfx;.endif; 7 | .endm;.macro hidden.str, pfx, sfx, m, va:vararg; hidden.count = hidden.count + 1 8 | .ifnb \va; \m "\pfx\()\sfx", \va 9 | .else; \m "\pfx\()\sfx";.endif; 10 | .endm;.macro hidden.alt, pfx, sfx, m, va:vararg; hidden.count = hidden.count + 1 11 | .ifnb \va; \m <\pfx\()\sfx>, \va 12 | .else; \m <\pfx\()\sfx> 13 | .endif;.endm;.macro hidden.get, pfx, sym; hidden.get.sfx \pfx, , \sym 14 | .endm;.macro hidden.set, pfx, val; hidden.set.sfx \pfx, , \val 15 | .endm;.macro hidden.get.sfx, pfx, sfx, sym=hidden 16 | hidden \pfx, \sfx, hidden.get.handler \sym 17 | .endm;.macro hidden.set.sfx, pfx, sfx, val=hidden 18 | hidden \pfx, \sfx, hidden.set.handler \val 19 | .endm;.macro hidden.get.handler, val, sym; \sym = \val 20 | .endm;.macro hidden.set.handler, sym, val; \sym = \val 21 | .endm;.endif; 22 | 23 | -------------------------------------------------------------------------------- /.include/punkpc/idxr.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module idxr, 2 3 | .if module.included == 0; punkpc xev;idxr.r=0 4 | .macro idxr, xr:vararg 5 | .irp s, len, beg, dep, end, idx, reg; idxr.\s=-1;.endr; 6 | .irpc c, \xr; idxr.len=idxr.len+1 7 | .ifc (, \c; idxr.dep=idxr.dep+1 8 | .if idxr.dep==0; idxr.beg=idxr.len+1;idxr.end=-1;.endif;.endif; 9 | .ifc ), \c; idxr.dep=idxr.dep-1 10 | .if idxr.dep==-1; idxr.end=idxr.len-1;.endif;.endif;.endr;xev 0, idxr.beg-2, \xr 11 | idxr.x=xev;xev idxr.beg, idxr.end, \xr;idxr.r=xev 12 | .endm;.endif; 13 | 14 | -------------------------------------------------------------------------------- /.include/punkpc/if.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module if, 1 3 | .if module.included == 0; punkpc ifalt, ifdef, ifnum;.endif 4 | 5 | -------------------------------------------------------------------------------- /.include/punkpc/ifalt.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module ifalt, 2 3 | .if module.included == 0 4 | .macro ifalt 5 | .irp alt_check, %1; alt=0 6 | .ifc \alt_check, 1; alt=1;.endif;nalt=alt^1;.endr; 7 | .endm;.macro ifalt.reset, reset_alt=alt 8 | .if \reset_alt; .altmacro 9 | .else; .noaltmacro;.endif;ifalt 10 | .endm;.endif; 11 | 12 | -------------------------------------------------------------------------------- /.include/punkpc/ifdef.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module ifdef, 3 3 | .if module.included == 0; punkpc ifalt;ifdef.alt = 0 4 | .macro ifdef, va:vararg; ifdef.alt = alt;ifalt;.noaltmacro;ifdef.__recurse \va;ifalt.reset 5 | alt = ifdef.alt 6 | .endm;.macro ifdef.__recurse, sym, conc, varargs:vararg 7 | .ifnb \conc; ifdef "\sym\conc", \varargs 8 | .else; .altmacro;ifdef.alt \sym;.endif; 9 | .endm;.macro ifdef.alt, sym; def=0;def_value=0 10 | .ifdef sym; def=1;def_value=\sym;.endif;ndef=def^1 11 | .endm;.endif; 12 | 13 | -------------------------------------------------------------------------------- /.include/punkpc/ifnum.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module ifnum, 5 3 | .if module.included == 0; num=0;nnum=1 4 | .macro ifnum, n; num=0 5 | .irpc c, \n 6 | .irpc d, 0123456789 7 | .ifc \c, \d; num=1;.exitm;.endif;.endr; 8 | .if num == 0 9 | .irpc d, +-*%/&^!~()[] 10 | .ifc \c, \d; num=2;.exitm;.endif;.endr;.endif;.exitm;.endr;nnum=!num 11 | .endm;.macro ifnum_ascii, n; num=0 12 | .irpc c, \n; ifnum.__get_ascii "'\c";.exitm;.endr;ifnum.check_ascii 13 | .endm;.macro ifnum.check_ascii, set_num=num; num=\set_num;nnum = 1 14 | .if num >= 0x28 15 | .if num <= 0x2D 16 | nnum=0;.exitm;.endif;.endif; 17 | .if num >= 0x2F 18 | .if num <= 0x39 19 | nnum=0;.exitm;.endif;.endif; 20 | .irp x, 0x21, 0x25, 0x26, 0x5B, 0x5D, 0x7C, 0x7E 21 | .if num == \x; nnum = 0;.exitm;.endif;.endr; 22 | .if nnum; num = 0;.endif; 23 | .endm;.macro ifnum.__get_ascii, c; num = \c 24 | .endm;.endif; 25 | 26 | -------------------------------------------------------------------------------- /.include/punkpc/items.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module items, 2 3 | .if module.included == 0; items.__free$ = 0;items.__mem$ = 0;items.alloc = 0;items.free = 0 4 | items = 0 5 | .macro items.method, self, __ppt 6 | .ifb \__ppt; items.method \self, \self;.exitm;.endif;items.__altm 7 | .irp __slf, \self\().is_items_method 8 | .ifndef __slf; \__slf = 0;.endif; 9 | .ifndef __ppt; \__ppt = 0;.endif;.endr;.noaltmacro 10 | .if \__ppt; items.free \__ppt;.endif; 11 | .if \self\().is_items_method == 0; items.alloc \__ppt;\self\().is_items_method = \__ppt 12 | .macro \self; .endm;.endif;.purgem \self 13 | .macro \self, va:vararg; items.mut.method.default \self, \__ppt, \va 14 | .endm;items.__altm_reset 15 | .endm;.macro items.mut.method.default, self, ppt, m, va:vararg 16 | .if \ppt >= 0 17 | .ifb \m\va; items.mut.blank.default \self, \ppt 18 | .elseif \ppt==0; items.mut.null.default \self, \ppt;.endif; 19 | .ifb \m; items.append \ppt, \va 20 | .else; items.emit \ppt, \m, \va;.endif;.endif; 21 | .endm;.macro items.mut.blank.default, self, ppt 22 | .if \self\().is_items_method == \ppt; items.free \self\().is_items_method;\ppt = 0 23 | .else; \ppt = \self\().is_items_method;.endif; 24 | .endm;.macro items.mut.null.default, self, ppt; items.free \self\().is_items_method 25 | items.alloc \ppt;\self\().is_items_method = \ppt 26 | .endm;.macro items.alloc, __va:vararg=items; items.__altm 27 | .irp __obj, \__va 28 | .if items.__free$ <= 0 29 | items.__new;.endif;items.__em , %items.__free$ 30 | .endr;items.__altm_reset 31 | .endm;.macro items.free, __va:vararg=items; items.__altm 32 | .irp __pntr, \__va 33 | .ifnb \__pntr 34 | .if (\__pntr > 0) 35 | items.__em %\__pntr 36 | \__pntr = 0;.endif;.endif;.endr;items.__altm_reset 37 | .endm;.macro items.append, __pntr=items, __va:vararg 38 | .if \__pntr > 0 39 | items.__altm 40 | .ifb \__va 41 | items.__em2 , %\__pntr, <.buf items.__append, items.__mem>, %\__pntr 42 | .else; 43 | items.__em2 , %\__pntr, <.buf items.__append, items.__mem>, %\__pntr, <, , \__va> 44 | .endif;items.__altm_reset;.endif; 45 | .endm;.macro items.emit, __pntr=items, __mcro=items.__statement, __va:vararg 46 | .if \__pntr > 0 47 | items.__altm;items.__em , %\__pntr, <.buf \__mcro, , \__va> 48 | .endif;.endm;.macro items.irp, __pntr=items, __mcro, __va:vararg 49 | .if \__pntr > 0 50 | items.__altm;items.__em , %\__pntr, <.buf items.__irp, \__mcro, \__va> 51 | .endif;.endm;.macro items.irpc, __pntr=items, __mcro, __va:vararg 52 | .if \__pntr > 0 53 | items.__altm;items.__em , %\__pntr, <.buf items.__irpc, \__mcro, \__va> 54 | .endif;.endm;.macro items.__irp, __mcro, __va:vararg 55 | .irp __itm, \__va 56 | .ifnb \__itm; \__mcro \__itm;.endif;.endr; 57 | .endm;.macro items.__irpc, __mcro, __va:vararg 58 | .irpc __itm, \__va 59 | .ifnb \__itm; \__mcro \__itm;.endif;.endr; 60 | .endm;.macro items.__statement, m, va:vararg; \m \va 61 | .endm;.macro items.__new; items.__mem$ = items.__mem$ + 1 62 | items.__em , %items.__mem$, <= items.__mem$> 63 | items.__em , %items.__mem$, <.purgem = 0> 64 | items.__em , %items.__mem$ 65 | items.__em , %items.__mem$;.endm; 66 | .macro items.__alloc, __obj, __pntr; \__obj = \__pntr 67 | items.__em , %\__pntr 68 | items.__free$ = items.__free$ - 1;items.__update 69 | .endm;.macro items.__build, __self 70 | .if \__self\().purgem; .purgem \__self\().buf;.endif;\__self\().purgem = 1;.noaltmacro 71 | .macro \__self\().buf, m, arg, va:vararg; items.__altm_reset;\m \arg \va 72 | .endm;.altmacro 73 | .endm;.macro items.__free, __self 74 | .if \__self\().purgem; .purgem \__self\().buf;\__self\().purgem = 0 75 | items.__free$ = items.__free$ + 1 76 | items.__em , %items.__free$, < = \__self> 77 | items.__update;.endif; 78 | .endm;.macro items.__append, __self, __varg:vararg 79 | \__self\().purgem = \__self\().purgem + 1;.purgem \__self\().buf;.noaltmacro 80 | .macro \__self\().buf, m, arg, va:vararg; items.__altm_reset;\m \arg \__varg \va 81 | .endm;.altmacro 82 | .endm;.macro items.__update; items.free = items.__free$ 83 | items.alloc = items.__mem$ - items.__free$ 84 | .endm;.macro items.__em, p, i, s, va:vararg; \p\()$\i\s\va 85 | .endm;.macro items.__em2, p, i, s, i2, s2, va:vararg; \p\()$\i\s\()$\i2\s2\va 86 | .endm;.macro items.__altm 87 | .irp _altm, %1; items.__altm=0 88 | .ifc \_altm, 1; items.__altm=1;.endif;.endr;.altmacro 89 | .endm;.macro items.__altm_reset 90 | .if items.__altm; .altmacro 91 | .else; .noaltmacro;.endif; 92 | .endm;items.method items;.endif 93 | 94 | -------------------------------------------------------------------------------- /.include/punkpc/library.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.version; punkpc.library.version = 0;.endif; 2 | .ifeq punkpc.library.version; punkpc.library.version = 0x100;module.included = 1;_punkpc = . 3 | .macro module.library, self, ext, default:vararg 4 | .macro \self, va:vararg 5 | .ifb \va 6 | .ifnb \default; \self \default;.endif; 7 | .else; .irp sym, \va 8 | .ifnb \sym; \self\().__mem_maindir \sym;.endif;.endr;.endif; 9 | .endm;.macro \self\().raw, va:vararg 10 | .irp args, \va; module.raw.build_args \self, \args;.endr; 11 | .endm;.macro \self\().module, m, version=1; module.included "\self", ".\m", ".version" 12 | .if module.included == 0 13 | .irp vsn, ".version"; \self\().\m\vsn = \version;.endr;.endif; 14 | .endm;.macro \self\().maindir, main; .purgem \self\().__mem_maindir 15 | .macro \self\().__mem_maindir, str, args, lude="lude", m="\main" 16 | \self\().__mem_subdir "\m", , , "\str", "\lude", "\args" 17 | .endm;.endm;.macro \self\().subdir, sub, ext; .purgem \self\().__mem_subdir 18 | .macro \self\().__mem_subdir, m, s="\sub", e="\ext", str, lude, args 19 | module.__parse_symdir \self, "\m", "\s", "\e", "\str", "\lude", "\args" 20 | .endm;.endm;.macro \self\().__mem_subdir; .endm;.macro \self\().__mem_maindir; .endm; 21 | \self\().maindir "\self\()/";\self\().subdir "";\self\().library.included = 1 22 | \self\().verify_vsn = 1 23 | .endm;.macro module.included, __mdul_pfx, __mdul_mid, __mdul_suf=".version" 24 | module.included = 0 25 | .if \__mdul_pfx\().verify_vsn; .altmacro 26 | module.included.alt \__mdul_pfx\__mdul_mid\__mdul_suf;.noaltmacro 27 | .if module.included 28 | .if \__mdul_pfx\__mdul_mid\__mdul_suf == 0; module.included = 0;.endif;.endif;.endif; 29 | .endm;.macro module.included.alt, __mdul_vsn; module.included = 0 30 | .ifdef __mdul_vsn; module.included = 1;.endif; 31 | .endm;.macro module.raw.build_args, self, file, va:vararg 32 | .ifb \va; \self\().__mem_maindir \file, , "bin" 33 | .else; \self\().__mem_maindir \file, ", \va" , "bin";.endif; 34 | .endm;.macro module.__parse_symdir, self, main, sub, ext, str, lude, args 35 | module.__chbegin = 0;module.__chend = 0;module.__chcount = 0;module.included = 0 36 | .if \self\().verify_vsn 37 | .irpc c, "\str" 38 | .ifc "\c", "/"; module.__chbegin = module.__chcount;.endif; 39 | .ifc "\c", "."; module.__chend = module.__chcount;.endif; 40 | module.__chcount = module.__chcount + 1;.endr; 41 | .ifb \ext; module.__chend = 0;.endif; 42 | .if module.__chend == 0; module.__chend = module.__chcount;.endif; 43 | module.___parse_symdir \self, "\str";.endif; 44 | .if module.included == 0; .inc\lude "\main\sub\str\ext" \args;.endif; 45 | .endm;.macro module.___parse_symdir, self, str, sym 46 | .if module.__chbegin >= module.__chend 47 | module.__chcount = 0 48 | .irpc c, "\str" 49 | .if module.__chcount < module.__chbegin 50 | module.__chcount = module.__chcount + 1;.else; 51 | module.___parse_symdir \self, "\str", "\sym\c";.exitm;.endif;.endr; 52 | .else; .if module.__chbegin == 0 53 | .ifb \sym; module.___parse_symdir \self, "\str", "\str";.exitm;.endif;.endif; 54 | module.included \self, ".\sym";.endif; 55 | .endm;.endif; 56 | 57 | -------------------------------------------------------------------------------- /.include/punkpc/list.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module list, 0x200 3 | .if module.included == 0; punkpc stack 4 | .macro list, self, varg:vararg; stack \self;\self\().step = 1 5 | .irp ppt, i, iter; \self\().\ppt=0;.endr;ifdef \self\().is_list 6 | .if ndef; \self\().is_list = 0;.endif; 7 | .if \self\().is_list == 0; \self\().is_list = \self\().is_stack 8 | .macro \self\().s, idx=\self\().ss, va:vararg 9 | mut.call \self, s, default, stack, , , \idx, \va 10 | .endm;.macro \self\().ss, idx=\self\().ss, va:vararg 11 | mut.call \self, ss, default, stack, , , \idx, \va 12 | .endm;.macro \self\().q, idx=\self\().qq, va:vararg 13 | mut.call \self, q, default, stack, , , \idx, \va 14 | .endm;.macro \self\().i, va:vararg=0; mut.call \self, i, default, stack, , , \va 15 | .endm;.macro \self\().get, idx=\self\().i, sym=\self, va:vararg 16 | mut.call \self, get, default, stack, , , \idx, \sym, \va 17 | .endm;.macro \self\().set, idx=\self\().i, val=\self, va:vararg 18 | mut.call \self, set, default, stack, , , \idx, \val, \va 19 | .endm;.macro \self\().new, size=1, fill=\self\().fill, va:vararg 20 | mut.call \self, new, default, stack, , , \size, \fill, \va 21 | .endm;.macro \self\().iter, va:vararg=\self 22 | mut.call \self, iter, default, stack, , , \va 23 | .endm;.endif;stack.purge_hook \self, i, get, set, iter, oob_iter, oob_i, idx_i 24 | .ifnb \varg; list \varg 25 | .else; .irp ppt, fill, size, ; stack.\ppt = 0;.endr;.endif; 26 | .endm;stack.meth, i, get, set, iter 27 | .macro stack.mut.i.default, self, va:vararg=0; mut.call \self, idx_i, range, stack, , , \va 28 | .endm;.macro stack.mut.get.default, self, idx, sym, va:vararg 29 | .ifb \sym\va; stack.mut.get.default \self, \idx, \self 30 | .else; .ifb \idx; \self\().i = \self\().i - 1 31 | .else; \self\().i = \idx - 1;.endif; 32 | .irp x, \sym, \va; \self\().i = \self\().i + 1 33 | .ifnb \x; sidx.get \self, \self\().i;\x = sidx;.endif;.endr;.endif; 34 | .endm;.macro stack.mut.set.default, self, idx, val, va:vararg; \self\().i = \idx - 1 35 | .irp x, \val, \va; \self\().i = \self\().i + 1 36 | .ifnb \x; sidx = \x;sidx.set \self, \self\().i;.endif;.endr; 37 | .endm;.macro stack.mut.iter.default, self, va:vararg 38 | .ifb \va; stack.mut.iter.default \self, \self 39 | .else; .irp sym, \va 40 | .ifnb \sym; stack.idx = \self\().i + \self\().step 41 | .if stack.idx >= \self\().s 42 | stack.oob=1;.elseif stack.idx < \self\().q; 43 | self.oob=1;.endif; 44 | .if stack.oob; mut.call \self, oob_iter, rot, stack, , , \va;.endif; 45 | .if stack.oob==0; \self\().i = stack.idx;\self\().iter = \self;\sym = \self 46 | stack.get \self;.endif;.endif;stack.oob=0;.endr;stack.oob=0;.endif; 47 | .endm;.macro stack.mut.oob_iter.nop, self, va:vararg; stack.oob=0 48 | .endm;.macro stack.mut.oob_iter.rot, self, sym, va:vararg 49 | stack.idx = stack.idx - \self\().q;stack.oob=0 50 | .if stack.idx; stack.idx = stack.idx % (\self\().s - \self\().q);.endif; 51 | .if stack.idx < 0 52 | stack.idx = \self\().s + stack.idx;.else; stack.idx = stack.idx + \self\().q;.endif; 53 | .endm;.macro stack.mut.oob_iter.null, self, sym, va:vararg; \sym = \self 54 | \self = \self\().fill 55 | .endm;.macro stack.mut.oob_iter.cap, self, va:vararg; \self\().i = \self\().s-\self\().step 56 | stack.oob=0 57 | .endm;.macro stack.mut.idx_i.range, self, idx, va:vararg 58 | stack.call_mut \self, oob_i, rot, (\idx + \self\().q) 59 | .endm;.macro stack.mut.idx_i.rel, self, idx, va:vararg 60 | stack.call_mut \self, oob_i, rot, (\idx + \self\().i) 61 | .endm;.macro stack.mut.idx_i.abs, self, idx, va:vararg 62 | stack.call_mut \self, oob_i, rot, \idx 63 | .endm;.macro stack.mut.oob_i.nop, self, idx, va:vararg; \self\().i = \idx 64 | .endm;.macro stack.mut.oob_i.rot, self, idx, va:vararg; \self\().i = \idx - \self\().q 65 | .if \self\().i; \self\().i = \self\().i % (\self\().s - \self\().q);.endif; 66 | .if \self\().i < 0 67 | \self\().i = \self\().s + \self\().i;.else; \self\().i = \self\().i + \self\().q;.endif; 68 | .endm;.macro stack.mut.oob_i.cap, self, idx, va:vararg; \self\().i = \idx 69 | .if \self\().i >= \self\().s 70 | \self\().i = \self\().s - 1;.endif; 71 | .if \self\().i < \self\().q 72 | \self\().i = \self\().q;.endif; 73 | .endm;.endif; 74 | 75 | -------------------------------------------------------------------------------- /.include/punkpc/lmf.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module lmf, 2 3 | .if module.included == 0; punkpc regs, idxr 4 | .macro lmfs, start, idxr, end=31; lmfs.r = \start & 31;idxr \idxr 5 | .if \end >= \start 6 | .rept ((\end&31)+1)-(\start&31) 7 | lfs lmfs.r, idxr.x(idxr.r);lmfs.r = lmfs.r + 1;idxr.x = idxr.x + 4;.endr; 8 | .else; .rept ((\start&31)+1)-(\end&31) 9 | lfs lmfs.r, idxr.x(idxr.r);lmfs.r = lmfs.r - 1;idxr.x = idxr.x + 4;.endr;.endif; 10 | .endm;.macro stmfs, start, idxr, end=31; stmfs.r = \start & 31;idxr \idxr 11 | .if \end >= \start 12 | .rept ((\end&31)+1)-(\start&31) 13 | stfs stmfs.r, idxr.x(idxr.r);stmfs.r = stmfs.r + 1;idxr.x = idxr.x + 4;.endr; 14 | .else; .rept ((\start&31)+1)-(\end&31) 15 | stfs stmfs.r, idxr.x(idxr.r);stmfs.r = stmfs.r - 1;idxr.x = idxr.x + 4;.endr;.endif; 16 | .endm;.macro lmfd, start, idxr, end=31; lmfd.r = \start & 31;idxr \idxr 17 | .if \end >= \start 18 | .rept ((\end&31)+1)-(\start&31) 19 | lfd lmfd.r, idxr.x(idxr.r);lmfd.r = lmfd.r + 1;idxr.x = idxr.x + 8;.endr; 20 | .else; .rept ((\start&31)+1)-(\end&31) 21 | lfd lmfd.r, idxr.x(idxr.r);lmfd.r = lmfd.r - 1;idxr.x = idxr.x + 8;.endr;.endif; 22 | .endm;.macro stmfd, start, idxr, end=31; stmfd.r = \start & 31;idxr \idxr 23 | .if \end >= \start 24 | .rept ((\end&31)+1)-(\start&31) 25 | stfd stmfd.r, idxr.x(idxr.r);stmfd.r = stmfd.r + 1;idxr.x = idxr.x + 8;.endr; 26 | .else; .rept ((\start&31)+1)-(\end&31) 27 | stfd stmfd.r, idxr.x(idxr.r);stmfd.r = stmfd.r - 1;idxr.x = idxr.x + 8;.endr;.endif; 28 | .endm;.endif; 29 | 30 | -------------------------------------------------------------------------------- /.include/punkpc/load.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module load, 3 3 | .if module.included == 0; punkpc regs 4 | .ifndef load.purgem; load.purgem = 0;.endif; 5 | .if load.purgem; .purgem load;.endif;load.purgem = 1 6 | .irp x, bufa, bufb, bufi, len, w, em, strinput; load.__\x=0;.endr;load.opt=1 7 | .macro load, r=-31, va:vararg; load.__rev=0;i=0;load.__str=0 8 | .irp x, bufa, bufb, bufi, len, w, em, strinput; load.__\x=0;.endr; 9 | .irpc c, \r 10 | .ifc \c, -; load.__rev=1;.endif;.exitm;.endr; 11 | .if load.__rev; load.__va (-(\r)), \va 12 | .else; load.__va \r, \va;.endif; 13 | .endm;.macro load.__va, r, a, va:vararg 14 | .ifnb \a; load.__strinput=0 15 | .irpc c, "\a" 16 | .if load.__strinput; load.__ch "'\c" 17 | .else; .ifc \c, > 18 | load.__strinput=1;load.__str=load.__str+1;i=0 19 | .else; .exitm;.endif;.endif;.endr; 20 | .if load.__strinput 21 | .rept (4-i)&3; load.__ch 0;.endr; 22 | .else; load.__buf \a;.endif;load.__va \r, \va 23 | .else; load.__w=load.__bufi;load.__bufi=-1;load.len=load.__w<<2 24 | .rept load.__w; load.__bufi=load.__bufi+1 25 | .if load.__rev; load.__em \r-load.__bufi 26 | .else; load.__em load.__bufi+\r;.endif;.endr;.endif; 27 | .endm;.macro load.__ch, c; i=(i+1)&3 28 | .if i&1; load.__bufa=(load.__bufb<<8)|(\c&0xFF) 29 | .else; load.__bufb=(load.__bufa<<8)|(\c&0xFF) 30 | .endif;.ifeq i; load.__buf load.__bufb;load.__bufb=0;.endif; 31 | .endm;.macro load.__buf, i; xem load.__buf$, load.__bufi, "<=\i>" 32 | load.__bufi=load.__bufi+1;.endm;.macro load.__em, r 33 | xem "", load.__bufi 34 | .if load.opt 35 | .if (load.__em>=-0x7FFF)&&(load.__em<=0x7FFF) 36 | li \r, load.__em;.else; 37 | lis \r, load.__em@h 38 | .if (load.__em&0xFFFF) 39 | ori \r, \r, load.__em@l;.endif;.endif; 40 | .else; 41 | lis \r, load.__em@h 42 | ori \r, \r, load.__em@l;.endif; 43 | .endm;.endif; 44 | 45 | -------------------------------------------------------------------------------- /.include/punkpc/mut.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module mut, 5 3 | .if module.included == 0; punkpc ifdef;mut.mutable_class$ = 0;mut.mutable_obj$ = 0 4 | mut.mutator$ = 0;mut.mutable_mode$ = 0;mut.uses_obj_mut_methods = 1 5 | .macro mut.class, class, mut_ns=mut, hook_ns=hook; ifdef \class\().is_mutable_class 6 | .if ndef; mut.mutable_class$ = mut.mutable_class$ + 1 7 | \class\().is_mutable_class=mut.mutable_class$;ifdef \class\().uses_obj_mut_methods 8 | .if ndef; \class\().uses_obj_mut_methods = mut.uses_obj_mut_methods;.endif; 9 | .macro \class\().hook, obj, hook; mut.hook \hook, \obj, \class, \mut_ns, \hook_ns 10 | .endm;.macro \class\().mut, obj, mut, hook 11 | .ifb \hook 12 | .ifnb \mut; mut.obj \obj, \class, \mut_ns, \mut 13 | .else; mut.obj \obj, \class, \mut_ns, \hook_ns;.endif; 14 | .else; mut.mut \mut, \hook, \obj, \hook_ns;.endif; 15 | .endm;.macro \class\().mode, obj, mode, hook 16 | mut.mode \mode, \hook, \obj, \class, \mut_ns, \hook_ns 17 | .endm;.macro \class\().call_\hook_ns, obj, hook, mode=default, va:vararg 18 | mut.call \obj, \hook, \mode, \class, \mut_ns, \hook_ns, \va 19 | .endm;.macro \class\().purge_hook, obj, va:vararg 20 | .irp hook, \va; mut.purge_hook \hook, \obj, \hook_ns;.endr; 21 | .endm;.endif; 22 | .endm;.macro mut.obj, obj, class, mut_ns=mut, hook_ns=hook; ifdef \obj\().is_mutable_obj 23 | .if ndef; mut.mutable_obj$ = mut.mutable_obj$ + 1 24 | \obj\().is_mutable_obj = mut.mutable_obj$ 25 | .if \class\().uses_obj_mut_methods 26 | .macro \obj\().hook, va:vararg 27 | .irp hook, \va; mut.hook \hook, \obj, \class, \mut_ns, \hook_ns;.endr; 28 | .endm;.macro \obj\().mut, mut, va:vararg 29 | .irp hook, \va; mut.mut "\mut", \hook, \obj, \hook_ns;.endr; 30 | .endm;.macro \obj\().mode, hook, va:vararg 31 | .irp mode, \va; mut.mode \mode, \hook, \obj, \class, \mut_ns, \hook_ns;.endr; 32 | .endm;.endif;.endif; 33 | .endm;.macro mut.hook, hook, obj, class, mut_ns=mut, hook_ns=hook 34 | mut.purge_hook \hook, \obj, \hook_ns 35 | .macro \obj\().\hook_ns\().\hook, va:vararg 36 | \class\().\mut_ns\().\hook\().default \obj, \va 37 | .endm;\obj\().\hook_ns\().\hook\().purgable = 1 38 | .endm;.macro mut.mut, mut, hook, obj, hook_ns=hook; mut.purge_hook \hook, \obj, \hook_ns 39 | .ifb \mut 40 | .macro \obj\().\hook_ns\().\hook, va:vararg; .endm;.else; 41 | .macro \obj\().\hook_ns\().\hook, va:vararg; \mut \obj, \va 42 | .endm;.endif;\obj\().\hook_ns\().\hook\().purgable = 1 43 | .endm;.macro mut.mode, mode=default, hook, obj, class, mut_ns=mut, hook_ns=hook 44 | mut.purge_hook \hook, \obj, \hook_ns;ifdef \class\().\mut_ns\().\hook\().mode$ 45 | .if ndef; \class\().\mut_ns\().\hook\().mode$ = 0;.endif; 46 | ifdef \class\().\mut_ns\().\hook\().\mode\().is_mutator_mode 47 | .if ndef; mut.mutable_mode$ = mut.mutable_mode$ + 1 48 | \class\().\mut_ns\().\hook\().\mode\().is_mutator_mode = mut.mutable_mode$ 49 | \class\().\mut_ns\().\hook\().mode$ = \class\().\mut_ns\().\hook\().mode$ + 1 50 | \class\().\mut_ns\().\hook\().\mode = \class\().\mut_ns\().\hook\().mode$;.endif; 51 | .macro \obj\().\hook_ns\().\hook, va:vararg 52 | \class\().\mut_ns\().\hook\().\mode \obj, \va 53 | .endm;\obj\().\hook_ns\().\hook\().mode = \class\().\mut_ns\().\hook\().\mode 54 | \obj\().\hook_ns\().\hook\().purgable = 1 55 | .endm;.macro mut.call, obj, hook, mode, class, mut_ns=mut, hook_ns=hook, va:vararg 56 | .if \obj\().\hook_ns\().\hook\().purgable; \obj\().\hook_ns\().\hook \va 57 | .else; \class\().\mut_ns\().\hook\().\mode \obj, \va;.endif; 58 | .endm;.macro mut.purge_hook, hook, obj, hook_ns=hook 59 | ifdef \obj\().\hook_ns\().\hook\().is_mutator 60 | .if def 61 | .if \obj\().\hook_ns\().\hook\().purgable; .purgem \obj\().\hook_ns\().\hook;.endif; 62 | .else; mut.mutator$ = mut.mutator$ + 1 63 | \obj\().\hook_ns\().\hook\().is_mutator = mut.mutator$ 64 | \obj\().\hook_ns\().\hook\().mode = 0;.endif;\obj\().\hook_ns\().\hook\().mode = 0 65 | \obj\().\hook_ns\().\hook\().purgable = 0 66 | .endm;.endif; 67 | 68 | -------------------------------------------------------------------------------- /.include/punkpc/ppc.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module ppc, 3 3 | .if module.included == 0; punkpc branch, cr, data, idxr, load, small, sp, gecko;.endif 4 | 5 | -------------------------------------------------------------------------------- /.include/punkpc/regs.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module regs, 3 3 | .if module.included == 0; punkpc xem, en 4 | .macro regs.enumerate, pfx, sfx, start=0, op="+1", cstart, cop, count=32 5 | .ifb \cop; regs.enumerate \pfx, \sfx, \start, \op, \cstart, \op, \count;.exitm;.endif; 6 | .ifb \cstart; regs.__c = \start 7 | .else; regs.__c = \cstart;.endif;regs.__i=\start 8 | .rept \count; xem \pfx, regs.__i, "<\sfx=regs.__c>" 9 | regs.__i = regs.__i\op;regs.__c = regs.__c\cop;.endr; 10 | .endm;.macro regs.rebuild 11 | .irpc c, rfb; regs.enumerate \c;.endr;regs.enumerate pfx=m, cstart=0x80000000, cop=">>1" 12 | regs.enumerate pfx=cr, count=8;sp=r1;rtoc=r2;lt=0;gt=1;eq=2;so=3;xem = 0 13 | .rept 8 14 | .irp s, lt, gt, eq, so; xem cr, xem, "<.\s=(xem*4)+\s>" 15 | .endr;xem = xem + 1;.endr; 16 | .endm;.macro regs, va:vararg; en.save regs.__backup;en.load regs;en \va;en.save regs 17 | en.load regs.__backup 18 | .endm;.macro regs.restart; regs.count = 3;regs.step = +1 19 | .endm;regs.rebuild;regs.restart;.endif 20 | 21 | -------------------------------------------------------------------------------- /.include/punkpc/sidx.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module sidx, 4 3 | .if module.included == 0; punkpc ifalt;.altmacro 4 | .macro sidx.em, p, i, s, va:vararg; .noaltmacro;\p\()$\i\s\va 5 | .endm;.macro sidx.ema, p, i, s, va:vararg; \p\()$\i\s\va 6 | .endm;.macro sidx.alt, p, i, s, va:vararg; sidx.ema \p, %\i, \s, \va 7 | .endm;.macro sidx.noalt, p, i, s, va:vararg; .altmacro;sidx.em \p, %\i, \s, \va 8 | .endm;.macro sidx.toalt, p, i, s, va:vararg; .altmacro;sidx.ema \p, %\i, \s, \va 9 | .endm;.macro sidx.em2, p, i, s, i2, s2, va:vararg; .noaltmacro;\p\()$\i\s\()$\i2\s2\va 10 | .endm;.macro sidx.ema2, p, i, s, i2, s2, va:vararg; \p\()$\i\s\()$\i2\s2\va 11 | .endm;.macro sidx.alt2, p, i, s, i2, s2, va:vararg 12 | sidx.ema2 \p, %\i, \s, %\i2, \s2, \va 13 | .endm;.macro sidx.noalt2, p, i, s, i2, s2, va:vararg; .altmacro 14 | sidx.em2 \p, %\i, \s, %\i2, \s2, \va 15 | .endm;.macro sidx.toalt2, p, i, s, i2, s2, va:vararg; .altmacro 16 | sidx.ema2 \p, %\i, \s, %\i2, \s2, \va 17 | .endm;.macro sidx.em3, p, i, s, i2, s2, i3, s3, va:vararg; .noaltmacro 18 | \p\()$\i\s\()$\i2\s2\()$\i3\s3\va 19 | .endm;.macro sidx.ema3, p, i, s, i2, s2, i3, s3, va:vararg 20 | \p\()$\i\s\()$\i2\s2\()$\i3\s3\va 21 | .endm;.macro sidx.alt3, p, i, s, i2, s2, i3, s3, va:vararg 22 | sidx.ema3 \p, %\i, \s, %\i2, \s2, %\i3, \s3 \va 23 | .endm;.macro sidx.noalt3, p, i, s, i2, s2, i3, s3, va:vararg; .altmacro 24 | sidx.em3 \p, %\i, \s, %\i2, \s2, %\i3, \s3 \va 25 | .endm;.macro sidx.toalt3, p, i, s, i2, s2, i3, s3, va:vararg; .altmacro 26 | sidx.ema3 \p, %\i, \s, %\i2, \s2, %\i3, \s3 \va 27 | .endm;.macro sidx.em4, p, i, s, i2, s2, i3, s3, i4, s4, va:vararg; .noaltmacro 28 | \p\()$\i\s\()$\i2\s2\()$\i3\s3\()$\i4\s4\va 29 | .endm;.macro sidx.ema4, p, i, s, i2, s2, i3, s3, i4, s4, va:vararg 30 | \p\()$\i\s\()$\i2\s2\()$\i3\s3\()$\i4\s4\va 31 | .endm;.macro sidx.alt4, p, i, s, i2, s2, i3, s3, va:vararg 32 | sidx.ema4 \p, %\i, \s, %\i2, \s2, %\i3, \s3, %\i4, \s4, \va 33 | .endm;.macro sidx.noalt4, p, i, s, i2, s2, i3, s3, va:vararg; .altmacro 34 | sidx.em4 \p, %\i, \s, %\i2, \s2, %\i3, \s3, %\i4, \s4, \va 35 | .endm;.macro sidx.toalt4, p, i, s, i2, s2, i3, s3, va:vararg; .altmacro 36 | sidx.ema4 \p, %\i, \s, %\i2, \s2, %\i3, \s3, %\i4, \s4, \va 37 | .endm;.macro sidx.get, p, i; .altmacro;sidx.ema , %\i 38 | .noaltmacro;.endm;.macro sidx.get2, p, i, i2; .altmacro 39 | sidx.ema2 , %\i, , %\i2 40 | .noaltmacro;.endm;.macro sidx.get3, p, i, i2, i3; .altmacro 41 | sidx.ema3 , %\i, , %\i2, , %\i3 42 | .noaltmacro;.endm;.macro sidx.get4, p, i, i2, i3, i4; .altmacro 43 | sidx.ema4 , %\i, , %\i2, , %\i3, , %\i4 44 | .noaltmacro;.endm;.macro sidx.set, p, i; .altmacro;sidx.ema \p, %\i, <=sidx> 45 | .noaltmacro;.endm;.macro sidx.set2, p, i, i2; .altmacro 46 | sidx.ema2 \p, %\i, , %\i2, <=sidx> 47 | .noaltmacro;.endm;.macro sidx.set3, p, i, i2, i3; .altmacro 48 | sidx.ema3 \p, %\i, , %\i2, , %\i3, <=sidx> 49 | .noaltmacro;.endm;.macro sidx.set4, p, i, i2, i3, i4; .altmacro 50 | sidx.ema4 \p, %\i, , %\i2, , %\i3, , %\i4, <=sidx> 51 | .noaltmacro;.endm;.noaltmacro 52 | .macro sidx.rept, self, va:vararg; sidx.memalt = alt;ifalt;sidx.alt = alt 53 | sidx.__rept \self, +1, \va 54 | .endm;.macro sidx.__rept, self, step, start=0, end=0, macro, va:vararg 55 | .if (\step > 0) && (\start > \end) 56 | sidx.__rept \self, -1, \start, \end, "\macro", \va;.else; sidx.__rept = \start 57 | sidx.__rept_count = (\end+1) - \start 58 | .if sidx.__rept_count < 0 59 | sidx.__rept_count = -sidx.__rept_count +2;.endif; 60 | .if sidx.__rept_count 61 | .rept sidx.__rept_count 62 | .ifb \va; sidx.noalt "", sidx.__rept 63 | .else; sidx.noalt "", sidx.__rept, , , \va 64 | .endif;sidx.__rept = sidx.__rept + \step;.endr;ifalt.reset sidx.alt 65 | alt = sidx.memalt;.endif;.endif; 66 | .endm;.macro sidx.__rept_iter, macro, mem, va:vararg; ifalt.reset sidx.alt 67 | \macro \mem \va 68 | .endm;.endif; 69 | 70 | -------------------------------------------------------------------------------- /.include/punkpc/small.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module small, 0x101 3 | .if module.included == 0; punkpc bcount, enum, ifalt 4 | .macro small.__instr_build, rlw 5 | .macro \rlw, va:vararg; small.__instr_handle \rlw, \va 6 | .endm;.endm;.macro small.__instr_handle, va:vararg; small.__altm = alt;ifalt 7 | small.__alt = alt;.noaltmacro;small.__instr \va;ifalt.reset small.__alt;alt = ifalt.__altm 8 | .endm;.macro small.__instr, rlw, d, a, m, va:vararg; .purgem \rlw 9 | .ifnb \va; \rlw \d, \a, (\m)&31, \va 10 | .else; small.__instr_logic \rlw, \d, \a, \m;.endif;small.__instr_build \rlw 11 | .endm;.macro small.__instr_logic, rlw, d, a, m; small.__beg = 0;small.__end = 0 12 | small.__rot = 0;small.__inv = 0;small.__ins = 0 13 | .ifc \rlw, rlwimi; small.__ins = 1 14 | .else; .ifc \rlw, rlwimi.; small.__ins = 1;.endif;.endif; 15 | .if \m; bcount.zbe \m, small.__beg;bcount.be \m;small.__end = (bcount-1)&31 16 | small.__inv = (small.__beg == 0) && (small.__end == 31) 17 | .if small.__inv; bcount.zbe ~(\m), small.__end;bcount.be ~(\m), small.__beg 18 | .if small.__ins; small.__rot = (32-small.__end)&31;small.__end = small.__end - 1 19 | .else; small.__rot = small.__end;small.__beg = small.__beg - small.__end 20 | small.__end = 31;.endif; 21 | .else; small.__rot = (31-small.__end)&31 22 | .if small.__ins == 0; small.__end = 31 23 | small.__beg = (small.__beg + small.__rot)&31;small.__rot = (32-small.__rot)&31 24 | .endif;.endif;\rlw \d, \a, (small.__rot&31), (small.__beg&31), (small.__end&31) 25 | .elseif small.__ins == 0; 26 | li \d, 0;.endif; 27 | .endm;.macro small.enable_insr_extr 28 | .if small.enable_insr_extr == 0; small.enable_insr_extr = 1 29 | .irp rlw, rlwinm, rlwinm., rlwimi, rlwimi.; small.__instr_build \rlw;.endr;.endif; 30 | .endm;.macro small.disable_insr_extr 31 | .if small.enable_insr_extr; small.enable_insr_extr = 0 32 | .irp rlw, rlwinm, rlwinm., rlwimi, rlwimi.; .purgem \rlw;.endr;.endif; 33 | .endm;small.enable_insr_extr = 0;small.enable_insr_extr;.endif 34 | 35 | -------------------------------------------------------------------------------- /.include/punkpc/spr.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module spr, 3 3 | .if module.included == 0; punkpc idxr, regs 4 | .macro lmspr, a, idxr, sprs:vararg; idxr \idxr;spr_count = 0 5 | .irp spr, \sprs 6 | .ifnb \spr; spr_count = spr_count + 1 7 | .rept 1 8 | .ifc \spr, cr 9 | lwz \a, idxr.x(idxr.r) 10 | mtcr \a;idxr.x=idxr.x+4;.exitm;.endif; 11 | .ifc \spr, CR 12 | lwz \a, idxr.x(idxr.r) 13 | mtcr \a;idxr.x=idxr.x+4;.exitm;.endif; 14 | .ifc \spr, sr 15 | lwz \a, idxr.x(idxr.r) 16 | mtsr \a;idxr.x=idxr.x+4;.exitm;.endif; 17 | .ifc \spr, SR 18 | lwz \a, idxr.x(idxr.r) 19 | mtsr \a;idxr.x=idxr.x+4;.exitm;.endif; 20 | .ifc \spr, msr 21 | lwz \a, idxr.x(idxr.r) 22 | mtmsr \a;idxr.x=idxr.x+4;.exitm;.endif; 23 | .ifc \spr, MSR 24 | lwz \a, idxr.x(idxr.r) 25 | mtmsr \a;idxr.x=idxr.x+4;.exitm;.endif;spr.__i=0 26 | .irpc c, \spr 27 | .irpc n, 0123456789 28 | .ifc \n, \c; spr.__i=1;.exitm;.endif;.endr;.exitm;.endr; 29 | .if spr.__i 30 | lwz \a, idxr.x(idxr.r) 31 | mtspr spr.\spr, \a;idxr.x=idxr.x+4 32 | .else; 33 | lwz \a, idxr.x(idxr.r) 34 | mtspr spr.\spr, \a;idxr.x=idxr.x+4;.endif;.endr;.endif;.endr; 35 | .endm;.macro stmspr, a, idxr, sprs:vararg; idxr \idxr;spr_count = 0 36 | .irp spr, \sprs 37 | .ifnb \spr; spr_count = spr_count + 1 38 | .rept 1 39 | .ifc \spr, cr 40 | mfcr \a 41 | stw \a, idxr.x(idxr.r);idxr.x=idxr.x+4;.exitm;.endif; 42 | .ifc \spr, CR 43 | mfcr \a 44 | stw \a, idxr.x(idxr.r);idxr.x=idxr.x+4;.exitm;.endif; 45 | .ifc \spr, sr 46 | mfsr \a 47 | stw \a, idxr.x(idxr.r);idxr.x=idxr.x+4;.exitm;.endif; 48 | .ifc \spr, SR 49 | mfsr \a 50 | stw \a, idxr.x(idxr.r);idxr.x=idxr.x+4;.exitm;.endif; 51 | .ifc \spr, msr 52 | mfmsr \a 53 | stw \a, idxr.x(idxr.r);idxr.x=idxr.x+4;.exitm;.endif; 54 | .ifc \spr, MSR 55 | mfmsr \a 56 | stw \a, idxr.x(idxr.r);idxr.x=idxr.x+4;.exitm;.endif;spr.__i=0 57 | .irpc c, \spr 58 | .irpc n, 0123456789 59 | .ifc \n, \c; spr.__i=1;.exitm;.endif;.endr;.exitm;.endr; 60 | .if spr.__i 61 | mfspr \a, \spr 62 | stw \a, idxr.x(idxr.r);idxr.x=idxr.x+4 63 | .else; 64 | mfspr \a, spr.\spr 65 | stw \a, idxr.x(idxr.r);idxr.x=idxr.x+4;.endif;.endr;.endif;.endr; 66 | .endm;spr.qr.default = 1;spr.XER = 1;spr.xer = 1;spr.LR = 8;spr.lr = 8;spr.CTR = 9;spr.ctr = 9 67 | spr.DSISR = 18;spr.dsisr = 18;spr.DAR = 19;spr.dar = 19;spr.DEC = 22;spr.dec = 22;spr.SDR1 = 25 68 | spr.sdr1 = 25;spr.SRR0 = 26;spr.srr0 = 26;spr.SRR1 = 27;spr.srr1 = 27;spr.SPRG0 = 272 69 | spr.sprg0 = 272;spr.SPRG1 = 273;spr.sprg1 = 273;spr.SPRG2 = 274;spr.sprg2 = 274;spr.SPRG3 = 275 70 | spr.sprg3 = 275;spr.EAR = 282;spr.ear = 282;spr.IBAT0U = 528;spr.ibat0u = 528;spr.IBAT0L = 529 71 | spr.ibat0l = 529;spr.IBAT1U = 530;spr.ibat1u = 530;spr.IBAT1L = 531;spr.ibat1l = 531 72 | spr.IBAT2U = 532;spr.ibat2u = 532;spr.IBAT2L = 533;spr.ibat2l = 533;spr.IBAT3U = 534 73 | spr.ibat3u = 534;spr.IBAT3L = 535;spr.ibat3l = 535;spr.DBAT0U = 536;spr.dbat0u = 536 74 | spr.DBAT0L = 537;spr.dbat0l = 537;spr.DBAT1U = 538;spr.dbat1u = 538;spr.DBAT1L = 539 75 | spr.dbat1l = 539;spr.DBAT2U = 540;spr.dbat2u = 540;spr.DBAT2L = 541;spr.dbat2l = 541 76 | spr.DBAT3U = 542;spr.dbat3u = 542;spr.DBAT3L = 543;spr.dbat3l = 543;spr.GQR0 = 912 77 | spr.QR0 = 912;spr.gqr0 = 912;spr.qr0 = 912;spr.GQR1 = 913;spr.QR1 = 913;spr.gqr1 = 913 78 | spr.qr1 = 913;spr.GQR2 = 914;spr.QR2 = 914;spr.gqr2 = 914;spr.qr2 = 914;spr.GQR3 = 915 79 | spr.QR3 = 915;spr.gqr3 = 915;spr.qr3 = 915;spr.GQR4 = 916;spr.QR4 = 916;spr.gqr4 = 916 80 | spr.qr4 = 916;spr.GQR5 = 917;spr.QR5 = 917;spr.gqr5 = 917;spr.qr5 = 917;spr.GQR6 = 918 81 | spr.QR6 = 918;spr.gqr6 = 918;spr.qr6 = 918;spr.GQR7 = 919;spr.QR7 = 919;spr.gqr7 = 919 82 | spr.qr7 = 919;spr.GQR = 913;spr.QR = 913;spr.gqr = 913;spr.qr = 913;spr.HID2 = 920 83 | spr.hid2 = 920;spr.WPAR = 921;spr.wpar = 921;spr.DMAU = 922;spr.dmau = 922;spr.DMAL = 923 84 | spr.dmal = 923;spr.MMCR0 = 952;spr.mmcr0 = 952;spr.PMC1 = 953;spr.pmc1 = 953;spr.PMC2 = 954 85 | spr.pmc2 = 954;spr.SIA = 955;spr.sia = 955;spr.MMCR1 = 956;spr.mmcr1 = 956;spr.PMC3 = 957 86 | spr.pmc3 = 957;spr.PMC4 = 958;spr.pmc4 = 958;spr.HID0 = 1008;spr.hid0 = 1008;spr.HID1 = 1009 87 | spr.hid1 = 1009;spr.IABR = 1010;spr.iabr = 1010;spr.DABR = 1013;spr.dabr = 1013;spr.L2CR = 1017 88 | spr.l2cr = 1017;spr.ICTC = 1019;spr.ictc = 1019;spr.THRM1 = 1020;spr.thrm1 = 1020 89 | spr.THRM2 = 1021;spr.thrm2 = 1021;spr.THRM3 = 1022;spr.thrm3 = 1022;spr.TBL = 268;spr.tbl = 268 90 | spr.TBU = 269;spr.tbu = 269;spr.UTBL = 284;spr.utbl = 284;spr.UTBU = 285;spr.utbu = 285 91 | spr.PVR = 287;spr.pvr = 287;spr.UMMCR0 = 936;spr.ummcr0 = 936;spr.UPMC1 = 937;spr.upmc1 = 937 92 | spr.UPMC2 = 938;spr.upmc2 = 938;spr.USIA = 939;spr.usia = 939;spr.UMMCR1 = 940;spr.ummcr1 = 940 93 | spr.UPMC3 = 941;spr.upmc3 = 941;spr.UPMC4 = 942;spr.upmc4 = 942;spr.cr = 0;spr.CR = 0 94 | spr.sr = 0;spr.SR = 0;spr.msr = 0;spr.MSR = 0;.endif 95 | 96 | -------------------------------------------------------------------------------- /.include/punkpc/xem.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module xem, 2 3 | .if module.included == 0 4 | .macro xem, p, x, s; .altmacro;xema \p, %\x, \s;.noaltmacro 5 | .endm;.macro xema, p, x, s; \p\x\s 6 | .endm;xem=0;.endif 7 | 8 | -------------------------------------------------------------------------------- /.include/punkpc/xev.s: -------------------------------------------------------------------------------- 1 | .ifndef punkpc.library.included 2 | .include "punkpc.s";.endif;punkpc.module xev, 1 3 | .if module.included == 0 4 | .macro xev, b=xe.beg, e=-1, va:vararg; xe.beg=\b;xe.end=\e&(-1>>1) 5 | xe.len=xe.beg-1;xev=-1;xe.ch, \va 6 | .endm;.macro xe.ch, e, va:vararg; xe.i=-1;xe.len=xe.len+1 7 | .irpc c, \va; xe.i=xe.i+1 8 | .if xe.i>xe.end 9 | .exitm;.elseif xe.i>=xe.len; 10 | xe.ch "\e\c", \va;.endif;.endr; 11 | .if xev==-1; xev=\e;.endif; 12 | .endm;.irp x, beg, end, len; xe.\x=0;.endr;xev=-1;.endif 13 | 14 | -------------------------------------------------------------------------------- /About.txt: -------------------------------------------------------------------------------- 1 | Written in Python v2.7.16 by DRGN of SmashBoards (Daniel R. Cappel). 2 | Compiled using cx-Freeze v5.1.1 3 | 4 | 5 | Find the official thread here for usage and other documentation: 6 | http://smashboards.com/threads/melee-code-manager-easily-add-codes-to-your-game.416437/ 7 | 8 | 9 | Check out the second post in the thread above for detailed info on some of this program's functionality and uses. 10 | 11 | If you're looking for the "settings.py" file, it's now located within the "lib" folder. 12 | If you're looking for the "codehandler.bin" file, it's now located within the "bin" folder. -------------------------------------------------------------------------------- /Mods Library/Stages.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/Mods Library/Stages.txt -------------------------------------------------------------------------------- /Mods Library/_funcs/!ReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | These functions, and the code in the root folder's .include directory, include many convenience functions and macros to make writing assembly code and small binaries easier. 3 | 4 | 5 | See here for documentation and examples: 6 | 7 | https://github.com/Punkline/punkpc 8 | 9 | https://github.com/Punkline/ppc_melee_codefuncs 10 | 11 | 12 | -------------------------------------------------------------------------------- /Mods Library/_funcs/Cast.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | Casting Functions 4 | Cast full 32-bit ints <> floats, with optional fixed point scales 5 | 6 | All integer inputs/outputs are either u32 or s32 7 | - Ints smaller than 32 use remaining bits as a fraction 8 | - These bits allow part of the mantissa to persist in an integer format 9 | 10 | All float inputs/outputs are read with double precision 11 | - paired singles operations will simply duplicate resulting ps0->ps1 12 | - When working with paired singles, consider hardware casting instead 13 | 14 | General-purpose fixed point casting can be done with 'fixed_*' ints 15 | - Custom fraction sizes can exceed actual bit size, as float 16 | - Negative scales will compress ints instead of add precision 17 | - Example fixed scales: +8=1/256, -8=256/1 18 | 19 | 20 | Cast Integer (r3) into -> Float (f1): 21 | 22 | u32.float # r3 -> f1 : 0xFFFFFFFF. : 0-bit fraction 23 | u24.float # r3 -> f1 : 0xFFFFFF.FF : 8-bit fraction 24 | u16.float # r3 -> f1 : 0xFFFF.FFFF : 16-bit fraction 25 | u8.float # r3 -> f1 : 0xFF.FFFFFF : 24-bit fraction 26 | u0.float # r3 -> f1 : 0x.FFFFFFFF : 32-bit fraction 27 | fixed_u32.float # r3 = int, r4 = fraction bit count 28 | 29 | s64.float # r3, r4 -> f1 : -0x7FFFFFFFFFFFFFFF 30 | s32.float # r3 -> f1 : -0x7FFFFFFF. : 0-bit fraction 31 | s24.float # r3 -> f1 : -0x7FFFFF.FF : 8-bit fraction 32 | s16.float # r3 -> f1 : -0x7FFF.FFFF : 16-bit fraction 33 | s8.float # r3 -> f1 : -0x7F.FFFFFF : 24-bit fraction 34 | fixed_s32.float # r3 = int, r4 = fraction bit count 35 | 36 | 37 | Cast Float (f1) into -> Integer (r3): 38 | 39 | float.u32 # r3 <- f1 : 0xFFFFFFFF. : 0-bit fraction 40 | float.u24 # r3 <- f1 : 0xFFFFFF.FF : 8-bit fraction 41 | float.u16 # r3 <- f1 : 0xFFFF.FFFF : 16-bit fraction 42 | float.u8 # r3 <- f1 : 0xFF.FFFFFF : 24-bit fraction 43 | float.u0 # r3 <- f1 : 0x.FFFFFFFF : 32-bit fraction 44 | float.fixed_u32 # r3 = fraction bit count 45 | 46 | float.s32 # r3 <- f1 : -0x7FFFFFFF. : 0-bit fraction 47 | float.s24 # r3 <- f1 : -0x7FFFFF.FF : 8-bit fraction 48 | float.s16 # r3 <- f1 : -0x7FFF.FFFF : 16-bit fraction 49 | float.s8 # r3 <- f1 : -0x7F.FFFFFF : 24-bit fraction 50 | float.fixed_s32 # r3 = fraction bit count 51 | [Punkline] 52 | NTSC 1.02 53 | 7C0802A6 9421FF00 90010104 9141002C 39410010 7C6AE5AA 54 | bl 0x80322da0 55 | 39410010 7C6AE4AA 8141002C 80010104 38210100 7C0803A6 4E800020 56 | 57 | 58 | 59 | ALL 60 | 38800000 61 | b 62 | ALL 63 | 38800008 64 | b 65 | ALL 66 | 38800010 67 | b 68 | ALL 69 | 38800018 70 | b 71 | ALL 72 | 38800020 73 | b 74 | ALL 75 | 38800000 76 | b 77 | ALL 78 | 38800008 79 | b 80 | ALL 81 | 38800010 82 | b 83 | ALL 84 | 38800018 85 | b 86 | ALL 87 | 3C008000 88 | b 89 | ALL 90 | 38000000 91 | b 92 | ALL 93 | # handles signed/unsigned int->float with custom exponent 94 | 9421FFE0 5484A016 9001000C 3C844330 7C600278 90810008 C8010008 9001000C C8210008 38210020 FC210028 4E800020 95 | 96 | 97 | ALL 98 | 38600000 99 | b 100 | ALL 101 | 38600008 102 | b 103 | ALL 104 | 38600010 105 | b 106 | ALL 107 | 38600018 108 | b 109 | ALL 110 | 38600020 111 | b 112 | ALL 113 | 38600000 114 | b 115 | ALL 116 | 38600008 117 | b 118 | ALL 119 | 38600010 120 | b 121 | ALL 122 | 38600018 123 | b 124 | ALL 125 | 3C004200 126 | b 127 | ALL 128 | 38000000 129 | b 130 | ALL 131 | # handles signed/unsigned float->ints with custom exponent 132 | 9421FFE0 2C000000 D8210008 80810008 5463A016 7C841A14 3C603F00 90810008 C8210008 90610010 C0010010 FC21002A 41A20054 3000FFFF 3C60FFF0 90010008 9061000C 38000000 3C604F80 90010010 90610014 C0010010 C8410008 FC01006E FC220828 FC21102E C0410014 FC011000 FC011028 FC20082E 38000000 41A00008 3C008000 FC20081E D8210008 8061000C 7C630278 38210020 4E800020 133 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Arch/Operations.txt: -------------------------------------------------------------------------------- 1 | 2 | -==- 3 | 4 | Archive Functions 5 | 6 | 7 | DVD.read_archive # rArch = alloc (or region ID) for output archive obj 8 | args: rFile, rOut, rArch 9 | <-- rNum, rOut, (null), rSize, (null), rArch, rMeta, rPath, (null) 10 | <-- cr1.eq: bInvalid 11 | 12 | arch.symbol # Look up region in file using a symbol string 13 | args: rArch, rString 14 | <-- rAddr, rString 15 | # - rArch may be ArchObj or File start 16 | # - rAddr will be null if not found 17 | 18 | arch.init # Initialize an archive, if not already initialized 19 | args: rAlloc, rFile, rDict 20 | <-- rArch 21 | # - rAlloc may be a 0x44-byte alloc, or a mem.ID (0...5) 22 | # - rDict will use default symbol events, if null 23 | 24 | # Init will use a dictionary to trigger arch.event 25 | # - events are only triggered on first attempt to call 26 | 27 | # Default init symbols are checked for if argument is null: 28 | "init.flush" # flushes instruction cache for regions of the file 29 | "init.call" # triggers callbacks included in the file 30 | "init.static" # creates static pointers to parts of the file 31 | 32 | # DVD.read_arch uses this default dictionary 33 | 34 | 35 | 36 | arch.check_init # Check to see if file has already been relocated 37 | args: rFile 38 | <-- cr1.lt: bInitialized, cr1.gt: bRelocated, cr1.eq: bNoRelocs 39 | # - bInitialized is true only if reloc was proven 40 | # - bRelocated is true when initialized, or no relocs are needed 41 | # - bNoRelocs is true when no relocs are in the reloc table 42 | # - having no relocs prevents bInitialized from being proven 43 | 44 | arch.event # Launch callbacks to handle matching symbols from dictionary 45 | args: r3 ... r10, rArch, rDict, cr1 ... cr7 46 | # - r3 ... r9 are passed to each callback (r10 is ignored) 47 | # - rArch (r11) can be an ArchObj or a File 48 | # - rDict (r12) must be formatted like below... 49 | 50 | rDict # Archive Symbol Event Dictionary format: 51 | 0x00 : WORD : pointer count 52 | 0x04 : ARRAY : start of pointer table (0x4-byte elements) 53 | 54 | # Each dictionary entry points to a callback that starts with: 55 | 0x00 : BRANCH INSTRUCTION : (branch over the following string) 56 | 0x04 : STRING : null-terminated symbol string definition 57 | ... : BRANCH DESTINATION : (callback instructions) 58 | 59 | arch.init # relocate and initialize an archive file (*.dat) 60 | args: rArch, rFileStart, rDict 61 | # If rDict is given as null, then default symbols will be used from arch.dict.init_default_events 62 | 63 | arch.symbol 64 | args: rArchive, rSymbol 65 | <-- rAddr 66 | [HSD, Punkline] 67 | 68 | NTSC 1.02 69 | # DVD outputs a DAT or USD file, and then initializes it 70 | # - archive object will use or generate a 0x44-byte allocation that can be used to reference symbols 71 | # --- args: 72 | # r3 = file (entrynum, path string pointer, or dvd offset) 73 | # r4 = output location (addr=target, 0=dynamic, 3=persistent, 4=semi-persistent) 74 | # r5 = archive object (-1 for none, else syntax is similar to r4) 75 | 76 | # --- returns: 77 | # cr1.eq = warning 'File not found' 78 | # cr1.lt = warning 'File still loading' 79 | # r3 = entrynum 80 | # r4 = output location 81 | # r5 = 0 -- (read offset is always 0 for full loads) 82 | # r6 = file size 83 | # r7 = -1 -- (sync callback is always blank on synchronous loads) 84 | # r8 = archive object 85 | # r9 = Allocation Metadata 86 | # r10 = path string 87 | # r11 = 0 88 | 7CA82B78 38A00000 38C0FFFF 38E0FFFF 89 | b 90 | 91 | 92 | NTSC 1.02 93 | # Look up a symbol string in a given Archive Object to return the part of the file it represents 94 | 95 | # --- args: 96 | # r3 = archive object (or file start) 97 | # r4 = search query (address of string) 98 | 99 | # --- returns: 100 | # r3 = address of file section (or 0 if symbol not found) 101 | # r4 = given query 102 | 7C0802A6 9421FF90 90010074 BFC10060 7C7F1B78 80BF0040 2C050000 7C9E2378 40800014 801F0000 80A50000 7C002800 41A20048 80C3000C 3BE10010 90DF000C 38830020 80030004 909F0020 7CA40214 80030008 5404103A 7CA52214 80030010 54C61838 90BF0028 54001838 7CA62A14 7C050214 901F0030 7FE3FB78 7FC4F378 103 | bl 0x80380358 104 | 7FC4F378 BBC10060 80010074 38210070 7C0803A6 4E800020 105 | 106 | NTSC 1.02 107 | # Check if an archive file has already been relocated 108 | 109 | # --- args: 110 | # r3 = start of archive file 111 | 112 | # --- returns: 113 | # r3 = start of archive file 114 | # r4 = start of archive relocation (null if no reloc table) 115 | # r5 = start of archive data (relocation base address) 116 | # cr1.lt = bInitialized -- a relocated pointer was found 117 | # cr1.gt = bRelocated -- true if bInitiailized OR bNoRelocs 118 | # cr1.eq = bNoRelocs -- true if no pointers need relocation 119 | 80030008 80830004 2C800000 38A30020 7C052214 38800000 41860014 7C040378 80040000 7C05002E 2C000000 4C803102 4CA62382 4E800020 120 | 121 | 122 | NTSC 1.02 123 | # Initialize a newly loaded archive file (DAT or USD file) 124 | # - init will skip already-initialized files to prevent corruption of pointers in data sections 125 | # - if a memory region ID is given instead of an allocation address, an allocation will be generated 126 | 127 | # --- args: 128 | # r3 = allocation for writing Archive Object information 129 | # r4 = File start -- to be initialized 130 | # r5 = initialization event symbol dictionary (or 0 for defaults) 131 | 132 | # --- returns: 133 | # r3 = instantiated archive object (from given r3) 134 | 135 | # --- callback event interface: 136 | # r3 = arch.init.event.rParams -- symbol region, for params 137 | # r4 = arch.init.event.rArch -- the archive object for this file 138 | # r5 = arch.init.event.rCB -- address of callback (self -- for local data) 139 | 7C0802A6 9421FFD0 90010034 7C000026 90010010 BF610014 7CBC2B79 7C9E2378 4180000C 140 | lis r0, <>@h 141 | ori r28, r0, <>@l 142 | 7C7F1B79 41A0001C 38800044 143 | bl 0x80015bd0 144 | 2C1F0002 7C7F1B78 41A00008 83E30004 7FC3F378 145 | bl 146 | 41840020 7FE3FB78 7FC4F378 80BE0000 147 | bl 0x80016a54 148 | 7F8CE378 7FEBFB78 149 | bl 150 | 7FE3FB78 BB610014 80010010 7C0FF120 80010034 38210030 7C0803A6 4E800020 151 | 152 | NTSC 1.02 153 | # Pass a dictionary of symbol:callback entries to this handler to trigger them as events 154 | 155 | # --- args: 156 | # r3...r9 = (stuff you want to give to each symbol-triggered callback in the event) 157 | # r10 = (unused) 158 | # r11 = archive object (will trigger callbacks for each matching symbol in dictionary) 159 | # r12 = archive symbol event dictionary (see format below) 160 | 161 | # --- dictionary format: 162 | # 0x0 = number of element pointers 163 | # 0x4 = start of n-element table array... (not a pointer) 164 | 165 | # --- dictionary element format: 166 | # 0x0 = branch instruction -> callback start 167 | # 0x4 = start of a null-terminated symbol string representing this event 168 | # - string must be unique for this dictionary, and becomes a key for matching symbol in file 169 | 7C0802A6 9421FFA0 90010064 BF610040 7FE00026 3BC10010 7D7B5B78 7C7EE5AA 7D9C6378 83BC0000 37BDFFFF 41800044 849C0004 7F63DB78 2C040000 40A0FFEC 38840004 170 | bl 171 | 2C030000 4080FFDC 7C6A1B78 7C7EE4AA 7FEFF120 819C0000 7F6BDB78 7D8803A6 4E800021 4BFFFFBC BB610040 80010064 38210060 7C0803A6 4E800020 172 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Arch/Symbol Handlers/Default.txt: -------------------------------------------------------------------------------- 1 | Default Symbols Dictionary 2 | This symbols dictionary is used by arch.init to define all default "init.*" symbols and symbol handlers 3 | - implements "init.flush", "init.static", and "init.call" by default 4 | - see symbols tab for more info 5 | [Punkline] 6 | 7 | NTSC 1.02 8 | 00000003 9 | .long <> 10 | .long <> 11 | .long <> 12 | 13 | 14 | 15 | 16 | -==- 17 | 18 | Archive "init.flush" handler 19 | 20 | Adding an "init.flush" symbol to your DAT file will cause this event to trigger on 21 | 22 | '.flush' allows you to specify regions of the file that have instructions 23 | - the CPU may crash if reading new instruction data with mismatching cache data 24 | - this flush allows the instruction cache to be synced after new instructions are loaded 25 | 26 | The file region for this symbol must begin with the following structure: 27 | 0x0 = number of regions to flush 28 | 0x4 = start of array of 8-byte pointer/size elements 29 | 0x0 = point to start of flush region 30 | 0x4 = specify number of bytes to flush 31 | - each region will have the instruction cache use updated instructions on next execution 32 | [Punkline] 33 | NTSC 1.02 34 | 48000010 696E6974 2E666C75 73680000 7C0802A6 9421FFE0 90010024 BFC10010 83CA0000 3BEAFFFC 37DEFFFF 41800018 809F0004 847F0008 7C841850 35 | bl 36 | 4BFFFFE8 BBC10010 80010024 38210020 7C0803A6 4E800020 37 | 38 | 39 | -==- 40 | 41 | Archive "init.call" handler 42 | 43 | Adding an "init.call" symbol to your DAT file will cause this event to trigger on 44 | 45 | '.call' allows you to specify callback(s) to execute after the file has synced/initialized 46 | 47 | The file region for this symbol must begin with the following structure: 48 | 0x0 = number of callback pointers 49 | 0x4 = start of array of 4-byte pointer elements 50 | 0x0 = point to callback (in file) to be executed 51 | - each listed callback pointer must be given an entry in the file's relocation table 52 | - all parts of the file to be called should also be defined with "init.flush" 53 | - each callback will be executed (in the order listed) right after the archive object is created 54 | - each callback recieves arguments r3=Archive Object, r4=Address of Self (callback) 55 | - after table finishes execution, the table's count param is updated to prevent re-execution 56 | [Punkline] 57 | NTSC 1.02 58 | 48000010 696E6974 2E63616C 6C000000 7C0802A6 9421FFE0 90010024 BFA10010 7D7F5B78 7D5E5378 83BE0000 2C1D0000 4081002C 7C1D00D0 93BE0000 37BDFFFF 4180001C 849E0004 2C040000 7C8803A6 7FE3FB78 4DA00021 4BFFFFE4 BBA10010 80010024 38210020 7C0803A6 4E800020 59 | 60 | 61 | -==- 62 | Archive "init.static" handler 63 | 64 | Adding an "init.static" symbol to your DAT file will cause this event to trigger on 65 | 66 | '.static' allows you to specify a static RAM address to create a pointer that points to a place in the file 67 | - these pointers may be used by the rest of the game environment without knowledge of the file or its archive object 68 | 69 | The file region for this symbol must begin with the following structure: 70 | 0x0 = number of static region pointers to create 71 | 0x4 = start of array of 0x8-byte link elements 72 | 0x0 = pointer to static RAM addresss (not relocated, out of file) 73 | 0x4 = pointer to file offset (relocated, inside of file) 74 | - each specified RAM address will have the relocated file pointer written to its location 75 | - when pointing to dynamic files this way, you will have to manage use of your static pointers accordingly 76 | [Punkline] 77 | 78 | NTSC 1.02 79 | 48000010 696E6974 2E737461 74696300 386AFFFC 808A0000 3484FFFF 4D800020 84A30008 80030004 90050000 4BFFFFEC 80 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/GObj/!Callbacks/GProc.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/Mods Library/_funcs/HSD/GObj/!Callbacks/GProc.txt -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/GObj/!Callbacks/GXCamera.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/Mods Library/_funcs/HSD/GObj/!Callbacks/GXCamera.txt -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/GObj/!Callbacks/GXDraw.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/Mods Library/_funcs/HSD/GObj/!Callbacks/GXDraw.txt -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/GObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | GObj Constructors 3 | 4 | GObj.new 5 | args: rClass, rPLink, rPPriority 6 | <-- rGObj 7 | 8 | GObj.new_ordered # rOrder 0 for incr, 1 for decr 9 | args: rOrder, rClass, rPLink, rPPriority, rPrevGObj 10 | <-- rGObj 11 | 12 | 13 | GDesc.load 14 | This is a special constructor designed to streamline creation of basic GObjs, with a flexible interface. An optional 'GDesc' (GObj Descriptor) struct may be given to represent some of the constructor arguments. 15 | 16 | The function takes 1 of 2 syntaxes: 17 | args: rGDesc 18 | args: rDataSize, rDestr, rGDesc 19 | <-- rGObj 20 | # if first arg is not an address, then longer syntax is used 21 | # rDestr is a custom callback to run when GObj data is freed 22 | # - a generic destructor is used if -1 is given 23 | # - destructor only executres if GObj or GObj data is explicitly destroyed 24 | 25 | GObj 'descriptors' ('GDescs') are only 0x10-bytes: 26 | GDesc.xGProc = 0x0 # point or branch to GProc callback 27 | GDesc.xGXDraw = 0x4 # point or branch to GXDraw callback 28 | GDesc.xSPriority = 0x8 # Priority for GProc child list 29 | GDesc.xData = 0x9 # 3-byte: Number of bytes for data 30 | GDesc.xPLink = 0xC # GProc group link ID 31 | GDesc.xGXLink = 0xD # GXDraw group link ID 32 | GDesc.xPPriority = 0xE # Priority for GObj carrying GProc 33 | GDesc.xGXPriority = 0xF # Priority for GObj carrying GXDraw 34 | 35 | # Default class ID is 0x7FFF -- with data type of 0x7F 36 | # Data and procs are not generated if nulls are given 37 | [HSD, Punkline] 38 | 39 | NTSC 1.02 40 | b 0x803901f0 41 | # args: rClass, rPLink, rPPriority 42 | # <-- rGObj 43 | 44 | NTSC 1.02 45 | b 0x8038FFB8 46 | # args: rOrder, rClass, rPLink, rPPriority, rPrevGObj 47 | # <-- rGObj 48 | 49 | NTSC 1.02 50 | # Instantiate a GObj using a small 0x10-byte 'GDesc' struct 51 | # --- args: 52 | # r3 = Address of GDesc 53 | 54 | # --- alternative args: 55 | # r3 = custom data size 56 | # r4 = custom data destructor callback 57 | # r5 = address of GDesc 58 | # - if GDesc argument not a valid address, then a generic one is used 59 | 60 | # --- returns: 61 | # r3 = initialized GObj 62 | 7C0802A6 9421FFD0 90010034 7C000026 90010010 BF210014 7C7B1B79 7C9C2378 7CBF2B78 40800008 7C7F1B78 3C008180 7E9F0000 41B40028 4800001C 4E800021 00000000 00000000 10000000 18131010 4E800020 4BFFFFE9 7FE802A6 40800010 837F0009 3B80FFFF 577BC23E 7C9C0000 4184000C 3F808037 639CF1B0 2D1B0000 7F3F44AA 572017BE 2F000001 40BA000C 573901FA 7F39FA14 574017BE 2F000001 40BA0010 575A01FA 7F5AFA14 3B5A0004 2D990000 2E1A0000 38607FFF 889F000C 88BF000E 63 | bl 0x803901f0 64 | 7C7E1B78 40890034 7F63DB78 65 | bl 0x8037f1e4 66 | 3880007F 7F85E379 7C661B78 7FC3F378 40A20008 38BF0010 67 | bl 0x80390B68 68 | 807E002C 7F64DB78 69 | bl 0x8000c160 70 | 408C0014 7FC3F378 7F24CB78 88BF0008 71 | bl 0x8038FD54 72 | 40900018 7FC3F378 7F44D378 88BF000D 88DF000F 73 | bl 0x8039069C 74 | 7FC3F378 BB210014 80010010 7C0FF120 80010034 38210030 7C0803A6 4E800020 75 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/GObj/Operations.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | GObj Operations 4 | 5 | Functions: 6 | 7 | GObj.run_GProcs # normally called by frame event loop... 8 | GObj.run_GXDraw 9 | args: (none) 10 | 11 | GObj.get_flag 12 | args: rOffset 13 | <-- rFlag 14 | 15 | GObj.PLink_get 16 | GObj.GXLink_get 17 | These can be used to return a GObj from the global PLink (Processing) or GXLink (Drawing) groups for the current scene. 18 | args: rLink, rClass, rIndex 19 | <-- rGObj 20 | 21 | # if rLink is a GObj address, then it is used as base link 22 | # - else, rLink is an ID between 0...63 23 | 24 | # if rClass is -1, then any class will qualify for lookup 25 | # if rIndex is is out of bounds, then NULL rGObj is returned 26 | # rIndex can be positive or negative to navigate next/prev 27 | 28 | 29 | 30 | GObj Methods: 31 | # the following all take a GObj argument in r3 32 | 33 | GObj.new_GProc # also attaches GProc to GObj 34 | args: rGObj, rProcCB, rSPriority 35 | <-- rGProc 36 | 37 | GObj.clear_all_GProcs 38 | args: rGObj 39 | 40 | GObj.PLink_append # insert as next PLink 41 | args: rGObj, rPrevGObj 42 | 43 | GObj.GXLink_append # insert as next GXLink 44 | args: rGObj, rPrevGObj 45 | 46 | GObj.destroy # destroys HSD Obj, Data, and GProcs, too 47 | args: rGObj 48 | 49 | GObj.GXLink_setup # sets up a GXDraw callback for Obj 50 | args: rGObj, rDrawCB, rGXLink, rGXPriority 51 | 52 | GObj.GXLink_setup_camera # sets up a Drawing camera 53 | args: rGObj, rDrawCB, rGXLink, rGXPriority 54 | 55 | GObj.GXLink_destructor 56 | args: rGObj 57 | 58 | GObj.object_init # attach an object instance to GObj 59 | args: rGObj, rObjType, rObj 60 | # rObjTypes: 0=SObj, 1=CObj, 2=LObj, 3=JObj, 4=Fog 61 | 62 | GObj.object_release # remove without destroying 63 | args: rGObj 64 | <-- rObj 65 | 66 | GObj.object_destroy # remove and run HSD destructor 67 | args: rGObj 68 | 69 | 70 | GObj.data_init # attach a data table to GObj 71 | args: rGObj, rDataType, rDestrCB, rData 72 | 73 | GObj.data_destroy # remove and run provided rDestrCB 74 | args: rGObj 75 | 76 | 77 | GObj.camera_set_texture 78 | args: rGObj, rPasses 79 | 80 | GObj.camera_set 81 | args: rGObj 82 | [HSD, Punkline] 83 | 84 | NTSC 1.02 85 | b 0x80390CFC 86 | NTSC 1.02 87 | b 0x80390FC0 88 | # args: (none) 89 | 90 | NTSC 1.02 91 | b 0x80390EB8 92 | # args: rOffset 93 | # <-- rFlag 94 | 95 | NTSC 1.02 96 | b 0x8038FD54 97 | # args: rGObj, rProcCB, rSPriority 98 | # <-- rGProc 99 | 100 | NTSC 1.02 101 | b 0x8038FED4 102 | # args: rGObj 103 | 104 | NTSC 1.02 105 | b 0x8038FF5C 106 | # args: rGObj, rPrevGObj 107 | 108 | NTSC 1.02 109 | b 0x8039063C 110 | # args: rGObj, rPrevGObj 111 | 112 | NTSC 1.02 113 | b 0x80390228 114 | # args: rGObj 115 | 116 | NTSC 1.02 117 | b 0x8039069C 118 | # args: rGObj, rDrawCB, rGXLink, rGXPriority 119 | 120 | NTSC 1.02 121 | b 0x8039075C 122 | # args: rGObj, rDrawCB, rGXLink, rGXPriority 123 | 124 | NTSC 1.02 125 | b 0x8039084C 126 | # args: rGObj 127 | 128 | NTSC 1.02 129 | b 0x80390A70 130 | # args: rGObj, rObjType, rObj 131 | 132 | NTSC 1.02 133 | b 0x80390ADC 134 | # args: rGObj 135 | # <-- rObj 136 | 137 | NTSC 1.02 138 | b 0x80390B0C 139 | # args: rGObj 140 | 141 | 142 | NTSC 1.02 143 | b 0x80390B68 144 | # args: rGObj, rDataType, rDestrCB, rData 145 | 146 | NTSC 1.02 147 | b 0x80390BE4 148 | # args: rGObj 149 | 150 | 151 | NTSC 1.02 152 | b 0x80390ED0 153 | # args: rGObj, rPasses 154 | 155 | NTSC 1.02 156 | b 0x803910D8 157 | # args: rGObj 158 | 159 | 160 | NTSC 1.02 161 | 38C0C18C 162 | b 163 | NTSC 1.02 164 | 38C0C184 165 | b 166 | NTSC 1.02 167 | 2C050000 38E00008 40A00010 38E0000C 38C6FFFC 7CA500D0 2C06C184 41A10008 38E70008 2C040000 7CC6682E 4180000C 5484103A 7C84302E 2C040000 40800028 2C03FFFF 41820010 A0040000 7C001800 40A2000C 34A5FFFF 4180000C 7C84382E 4BFFFFD8 7C832378 4E800020 168 | 169 | 170 | -==- 171 | GProc Operations 172 | 173 | Methods: 174 | GProc.link 175 | GProc.free 176 | GProc.reparent 177 | args: rGProc 178 | # these all just take a sole GProc argument 179 | [HSD] 180 | 181 | NTSC 1.02 182 | b 0x8038FAA8 183 | NTSC 1.02 184 | b 0x8038FC18 185 | NTSC 1.02 186 | b 0x8038FCE4 187 | # args: rGProc 188 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/AObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | AObj Constructors 3 | 4 | AObj.loadDesc 5 | args: rAObjDesc 6 | <- rAObj 7 | 8 | FObj.loadDesc 9 | args: rFObjDesc 10 | <- rFObj 11 | 12 | [HSD] 13 | NTSC 1.02 14 | b 0x8036439c 15 | NTSC 1.02 16 | b 0x8036b73c 17 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/AObj/Operations.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | AObj Operations 3 | 4 | Methods: 5 | 6 | AObj.setRate 7 | # Sets the animation frame rate of an AObj 8 | args: rAObj, fRate 9 | 10 | [HSD] 11 | NTSC 1.02 12 | # Sets the animation frame rate of an AObj 13 | 14 | # --- args: 15 | # r3 = AObj 16 | # f1 = Anim Frame Rate 17 | b 0x8036530c 18 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/CObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | CObj Constructors 3 | 4 | CObj.loadDesc 5 | args: rCObjDesc 6 | <- rCObj 7 | 8 | [HSD] 9 | NTSC 1.02 10 | b 0x8036a590 11 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/CObj/Operations.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | CObj Operations 4 | 5 | CObj.getCurrent 6 | <- rCObj 7 | 8 | [HSD] 9 | NTSC 1.02 10 | b 0x8036a288 11 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/DObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | DObj Constructors 3 | 4 | DObj.loadDesc 5 | args: rDObjDesc 6 | <- rDObj 7 | 8 | [HSD] 9 | NTSC 1.02 10 | b 0x8035e1b4 11 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/Fog/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | Fog Constructors 3 | 4 | Fog.loadDesc 5 | args: rFogDesc 6 | <- rFog 7 | 8 | FogAdj.loadDesc 9 | args: rFogAdjDesc 10 | <- rFogAdj 11 | 12 | [HSD] 13 | NTSC 1.02 14 | b 0x8037dc38 15 | NTSC 1.02 16 | b 0x8037dd58 17 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/JObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | JObj Constructors 3 | 4 | JObj.loadDesc 5 | args: rJObjDesc 6 | <- rJObj 7 | 8 | RObj.loadDesc 9 | args: rRObjDesc 10 | <- rRObj 11 | 12 | [HSD] 13 | NTSC 1.02 14 | b 0x80370bec 15 | NTSC 1.02 16 | b 0x8037c1ec 17 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/JObj/Operations.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | JObj Operations 4 | 5 | Methods: 6 | JObj.select 7 | # Select the Nth JObj from a skeleton using a bone in its joint family 8 | args: rJObj, rID 9 | <-- rIndexedJObj 10 | # - child/sibling tree is flattened into linear index 11 | # - children are counted before siblings 12 | 13 | JObj.set_AnimJoint 14 | # Assign Joint and/or Texture animation constructions to an existing JObj skeleton 15 | # Also assigns a starting frame for animation 16 | args: rJObj, rAnimJoint, rTexAnim, rShapeAnim, rID, fStart 17 | <-- rJObj 18 | # - anim descriptors may be null pointers, to skip construction 19 | # - anim descriptors may be given as a list of pointers to tree roots 20 | # - this will be implied if rID is 0+, causing an anim to be selected 21 | # - if rID == -1, then anim descriptors are used as given 22 | 23 | JObj.set_AnimJoint_ints 24 | # Alternative input syntax for .set_AnimJoint uses low/high r7 param instead of floating point 25 | args: rJObj, rAnimJoint, rTexAnim, rShapeAnim, rParam 26 | <-- rJObj 27 | # rParam: 28 | # +FFFF0000 = anim starting frame (0xFFFF -- unsigned hword; 0-bit mantissa) 29 | # +0000FFFF = Selection index (0xFFFF -- unsigned hword; 0-bit mantissa) 30 | 31 | JObj.check_DirtySub 32 | # Flags JObj matrix for animation transform updates, if necessary 33 | args: rJObj 34 | 35 | 36 | 37 | JObj.addAnimAll 38 | # Assign Joint and Texture animation constructor trees to an existing JObj skeleton 39 | args: rJObj, rAnimJoint, rTexAnim, rShapeAnim 40 | # - each arg is the root of a tree of assets 41 | # - each arg (besides the JObj) may be null to skip 42 | 43 | JObj.reqAnimAll 44 | # Flags a JObj (skeleton) for animation, and sets a starting frame 45 | args: rJObj, rAnimJoint, fStart 46 | 47 | JObj.setMtxDirtySub 48 | # Used to apply iterative frame-wise transformation to joints based on animations 49 | args: rJObj 50 | 51 | [HSD, Punkline] 52 | NTSC 1.02 53 | # Assign Joint and Texture animation constructor trees to an existing JObj skeleton 54 | # --- args: 55 | # r3 = JObj tree 56 | # r4 = AnimJoint tree 57 | # r5 = TexAnim tree 58 | # r6 = ShapeAnim tree 59 | # - each may be null, to skip construction 60 | b 0x8036fb5c 61 | 62 | NTSC 1.02 63 | # Flags a JObj for animation and sets a starting frame 64 | 65 | # --- args: 66 | # r3 = JObj root 67 | # r4 = AnimJoint root 68 | # f1 = starting frame 69 | 70 | b 0x8036f8bc 71 | 72 | NTSC 1.02 73 | # Used to apply iterative frame-wise transformations to joints based on animations 74 | # r3 = JObj 75 | b 0x803732E8 76 | 77 | 78 | 79 | NTSC 1.02 80 | # Select the Nth JObj from a skeleton using any bone in its joint family 81 | # r3 = root JObj (or member of family) 82 | # r4 = ID to select 83 | 7C0802A6 9421FFD0 90010034 7C651B78 2C050000 40800010 7CA32B78 80A3000C 4BFFFFF0 7C852378 38810010 38C0FFFF 4CC63102 84 | bl 0x80011e24 85 | 80610010 80010034 38210030 7C0803A6 4E800020 86 | 87 | 88 | 89 | NTSC 1.02 90 | # Assign Joint and Texture animation constructor trees to an existing JObj skeleton 91 | # --- args: 92 | # r3 = JObj root 93 | # r4 = AnimJoint (or AnimJointList) 94 | # r5 = TexAnim (or TexAnimList) 95 | # r6 = ShapeAnim (or ShapeAnimList) 96 | # r7 = Selection Index 97 | # - if ID is 0+, then the nth pointer from lists given in r4, r5, r6 will be used 98 | # - else r4, r5, r6 will be used directly 99 | # - r4, r5, r6 may be null, to skip them 100 | # f1 = Starting Frame (for AnimJoint) 101 | 102 | # --- returns: 103 | # r3 = JObj root 104 | 7C0802A6 9421FFE0 90010024 BFC10010 DBE10018 7C9E2379 FFE00890 7C7F1B78 4180002C 57C0103A 2C040000 41820008 7C84002E 2C050000 41820008 7CA5002E 2C060000 41820008 7CC6002E 105 | bl 106 | 7FE3FB78 FC20F890 107 | bl 108 | 7FE3FB78 CBE10018 BBC10010 80010024 38210020 7C0803A6 4E800020 109 | 110 | 111 | 112 | NTSC 1.02 113 | # alternative to set_animJoint uses high in r7 to specify starting frame as integer 114 | 115 | # --- args: 116 | # r3 = JObj root 117 | # r4 = AnimJoint (or AnimJointList) 118 | # r5 = TexAnim (or TexAnimList) 119 | # r6 = ShapeAnim (or ShapeAnimList) 120 | # r7 = Params: 121 | # +FFFF0000 = anim starting frame (0xFFFF -- unsigned hword; 0-bit mantissa) 122 | # +0000FFFF = Selection index (0xFFFF -- unsigned hword; 0-bit mantissa) 123 | # - if ID is 0+, then the nth pointer from lists given in r4, r5, r6 will be used 124 | # - else r4, r5, r6 will be used directly 125 | # - r4, r5, r6 may be null, to skip them 126 | 127 | # --- returns: 128 | # r3 = JObj root 129 | 9421FFF0 90E10008 E021C008 38210010 130 | b 131 | 132 | 133 | NTSC 1.02 134 | 80030014 5400018D 4C820020 54000211 4082000C 54000673 4C820020 135 | b 136 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/MObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | MObj Constructors 3 | 4 | MObj.loadDesc 5 | args: rMObjDesc 6 | <- rMObj 7 | 8 | [HSD] 9 | NTSC 1.02 10 | b 0x803631e4 11 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/PObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | PObj Constructors 3 | 4 | PObj.loadDesc 5 | args: rPObjDesc 6 | <- rPObj 7 | 8 | [HSD] 9 | NTSC 1.02 10 | b 0x8036be64 11 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/TObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | TObj Constructors 3 | 4 | TObj.loadDesc 5 | args: rTObjDesc 6 | <- rTObj 7 | 8 | Tlut.loadDesc 9 | args: rTlutDesc 10 | <- rTlut 11 | 12 | TObjTev.loadDesc 13 | args: rTevDesc 14 | <- rTev 15 | 16 | [HSD] 17 | NTSC 1.02 18 | b 0x8035ed28 19 | NTSC 1.02 20 | b 0x8035edc0 21 | NTSC 1.02 22 | b 0x8035ee14 23 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/TObj/Operations.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | TObj Operations 4 | 5 | Methods: 6 | 7 | TObj.set_TexAnim 8 | # Assign a TexAnim directly to a TObj with custom starting frame and frame rate 9 | # - instantiates an AObj for this TObj, freeing any previously assigned AObjs before construction 10 | args: rTObj, rTexAnim, fStart, fRate 11 | <-- rTObj, rTexAnim, rAObj 12 | 13 | TObj.set_TexAnim_ints 14 | # Alternative syntax uses high/low param in r5 to replace floating point inputs 15 | args: rTObj, rTexAnim, rParam 16 | <-- rTObj, rTexAnim, rAObj 17 | # rParam: 18 | # +FFFF0000 = anim starting frame (0xFFFF -- unsigned hword; 0-bit mantissa) 19 | # +0000FFFF = anim frame rate (-0x7F.FF -- signed hword; 8-bit mantissa) 20 | 21 | 22 | TObj.addAnimAll 23 | # Assign a TexAnim directly to a TObj 24 | args: rTObj, rTexAnim 25 | # - instantiates an AObj for this TObj, freeing any previously assigned AObjs before construction 26 | 27 | TObj.reqAnimAll 28 | # Flags a TObj for animation, and sets a starting frame 29 | args: rTObj, fStart 30 | [HSD, Punkline] 31 | 32 | NTSC 1.02 33 | # Assign a TexAnim directly to a TObj 34 | # - instantiates an AObj for this TObj, freeing any previously assigned AObjs before construction 35 | 36 | # --- args: 37 | # r3 = TObj 38 | # r4 = TexAnim 39 | b 0x8035e708 40 | 41 | NTSC 1.02 42 | # Flags a TObj for animation, and sets a starting frame 43 | 44 | # --- args: 45 | # r3 = TObj 46 | # f1 = Anim Starting Frame 47 | b 0x8035e800 48 | 49 | 50 | # --- custom functions 51 | NTSC 1.02 52 | # Assign a TexAnim directly to a TObj, with input ReqAnim and AObjRate float values 53 | # - instantiates an AObj for this TObj, freeing any previously assigned AObjs before construction 54 | 55 | # --- args: 56 | # r3 = TObj 57 | # r4 = TexAnim (links a TObj to an AObjDesc) 58 | # f1 = Anim Starting Frame 59 | # f2 = Anim Frame Rate 60 | 61 | # --- returns: 62 | # r3 = TObj (as given) 63 | # r4 = TexAnim (as given) 64 | # r5 = AObj (for this TObj) 65 | 7C0802A6 9421FFD0 90010034 BFA10010 DBE10020 DBC10028 7C7F1B78 FFE00890 7C9E2378 FFC01090 66 | bl 67 | 7FE3FB78 FC20F890 83BF0064 68 | bl 69 | 7FA3EB78 FC20F090 70 | bl 71 | 7FE3FB78 7FC4F378 7FA5EB78 CBE10020 CBC10028 BBA10010 80010034 38210030 7C0803A6 4E800020 72 | 73 | 74 | NTSC 1.02 75 | # Alternative version of set_TexAnim that uses integer inputs instead of floats: 76 | # --- args: 77 | # r3 = TObj 78 | # r4 = TexAnim 79 | # r5 = Params: 80 | # +FFFF0000 = anim starting frame (0xFFFF -- unsigned hword; 0-bit mantissa) 81 | # +0000FFFF = anim frame rate (-0x7F.FF -- signed hword; 8-bit mantissa) 82 | 83 | # --- returns: 84 | # r3 = TObj (as given) 85 | # r4 = TexAnim (as given) 86 | # r5 = AObj (for this TObj) 87 | 9421FFF0 90A10008 3C000804 7CB7E2A6 E021C008 7C17E3A6 E041F00A 7CB7E3A6 38210010 88 | b 89 | -------------------------------------------------------------------------------- /Mods Library/_funcs/HSD/Obj/WObj/Constructors.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | WObj Constructors 3 | 4 | WObj.loadDesc 5 | args: rWObjDesc 6 | <- rWObj 7 | 8 | [HSD] 9 | NTSC 1.02 10 | b 0x8037d3c4 11 | -------------------------------------------------------------------------------- /Mods Library/_funcs/Math/Math.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | Extra Math Functions 4 | 5 | rsqrt # reciprocal square root (1 / SQRT) 6 | args: fValue 7 | <-- rRSQRT 8 | 9 | sqrt # square root (RSQRT * fValue) 10 | args: fValue 11 | <-- rSQRT 12 | 13 | 14 | ps_byte_lerp # hw accelerated lerps between arrays of bytes 15 | args: rFloor, rCeil, rOut, rCount, fCoef 16 | <-- rFloor, rCeil, rOut, fCoef 17 | # - rFloor, rCeil, and rOut are base pointers to arrays 18 | # - rCount must be even, to work in pairs 19 | # - results are floored and capped without rounding 20 | 21 | color.lerp # hw accelerated lerps between direct RGBA colors 22 | args: rFloor, rCeil, fCoef 23 | <-- rFloor, rCeil, rMixed, fCoef 24 | # - rFloor, rCeil, and rMixed are RGBA colors, not pointers 25 | # - results are rounded and capped 26 | 27 | [?, Punkline] 28 | 29 | NTSC 1.02 30 | # Calculate reciprocal square root (1 / SQRT) 31 | # --- args: 32 | # f1 = fValue 33 | 34 | # --- returns: 35 | # f1 = fRSQRT 36 | b 0x80022df8 37 | 38 | 39 | 40 | NTSC 1.02 41 | # Calculate square root from * fValue 42 | # --- args: 43 | # f1 = fValue 44 | 45 | # --- returns: 46 | # f1 = fSQRT 47 | 7C0802A6 9421FFE0 90010024 D0210010 48 | bl 49 | C0010010 EC210032 80010024 38210020 7C0803A6 4E800020 50 | 51 | 52 | 53 | 54 | 55 | ALL 56 | # Fast Linear Interpolation between a pair of byte arrays 57 | # - all outputs are capped to unsigned byte range 58 | 59 | # --- args: 60 | # r3 = address of input A base (floor) 61 | # r4 = address of input B base (ceil) 62 | # r5 = address of output base 63 | # r6 = number of bytes (must be even) 64 | # f1 = interpolation percentage (floor...ceil) 65 | 3C000804 7CF7E2A6 60000804 54C6003C 7C17E3A6 34C6FFFE 4180001C 1043338C 1064338C 10031028 1000105C 1003338E 4BFFFFE4 7CF7E3A6 4E800020 66 | 67 | 68 | ALL 69 | 7C0802A6 9421FFF0 90010014 3C003B00 90610010 90010010 7CD7E2A6 3C000804 C0810010 60000804 90810010 7C17E3A6 E0417010 E0617010 10031028 1042202A E0617012 1000105C E0417012 F0017010 10031028 1042202A 1000105C F0017012 80A10010 7CD7E3A6 80010014 38210010 7C0803A6 4E800020 70 | -------------------------------------------------------------------------------- /Mods Library/_funcs/Math/Rand.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | Random Number Generators 4 | 5 | rand.int # return random 32-bit integer 6 | <-- rRand 7 | 8 | rand.max_int # random int between 0 and 'rMax' 9 | args: rMax 10 | <-- rRand 11 | 12 | rand.float # random percent between 0.0 and 1.0 13 | <-- fRand 14 | 15 | rand.max_float # random float between 0 and 'fMax' 16 | args: fMax 17 | <-- fRand 18 | 19 | rand.fill # fill target with random bits for 'rSize' bytes 20 | args: rOut, rSize 21 | <-- rOut 22 | 23 | [?, Punkline] 24 | 25 | 26 | NTSC 1.02 27 | # Produce a random 32-bit integer 28 | # --- returns: 29 | # r3 = rRand 30 | b 0x803804f8 31 | 32 | 33 | 34 | NTSC 1.02 35 | # Produce a random float between 0.0 and 1.0 36 | # --- returns: 37 | # f1 = fRand 38 | b 0x80380528 39 | 40 | 41 | 42 | NTSC 1.02 43 | # Produces a random integer between 0 and the given number 44 | # --- args: 45 | # r3 = rMax 46 | 47 | # --- returns: 48 | # r3 = rRand 49 | b 0x80380580 50 | 51 | NTSC 1.02 52 | # Produces a random integer between 0 and the given number 53 | # --- args: 54 | # r3 = rMax 55 | 56 | # --- returns: 57 | # r3 = rRand 58 | b 0x80380580 59 | 60 | NTSC 1.02 61 | # Produces a random float between 0 and the given number 62 | # --- args: 63 | # f1 = fMax 64 | 65 | # --- returns: 66 | # f1 = fRand 67 | 7C0802A6 9421FFE0 90010024 D0210010 68 | bl 69 | C0010010 EC210032 80010024 38210020 7C0803A6 4E800020 70 | 71 | 72 | 73 | 74 | NTSC 1.02 75 | # Fill n bytes with random bits at target location 76 | # --- args: 77 | # r3 = rOut 78 | # r4 = rSize 79 | 80 | # --- returns 81 | # r3 = rOut 82 | 7C0802A6 9421FFE0 90010024 BFA10010 7C7E1B78 3BE3FFFE 7C9D2379 40810028 3C600002 3863FFFF 83 | bl 84 | 37BDFFFE 41800010 B47F0002 4181FFE8 48000008 987F0002 7FC3F378 BBA10010 80010024 38210020 7C0803A6 4E800020 85 | -------------------------------------------------------------------------------- /Mods Library/_funcs/Math/Trig.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | Trigonometry Functions 4 | 5 | sin 6 | cos 7 | tan 8 | asin 9 | acos 10 | atan # all of these have a similar f1 interface 11 | args: fAngle 12 | <-- fOutput 13 | 14 | atan2 15 | args: fY, fX 16 | <-- fAtan2 17 | [?] 18 | 19 | 20 | 21 | NTSC 1.02 22 | # Calculate sine of angle in f1 23 | # --- args: 24 | # f1 = fAngle 25 | 26 | # --- returns: 27 | # f1 = fSin 28 | b 0x803263d4 29 | 30 | 31 | 32 | NTSC 1.02 33 | # Calculate cosine of angle in f1 34 | # --- args: 35 | # f1 = fAngle 36 | 37 | # --- returns: 38 | # f1 = fCos 39 | b 0x80326240 40 | 41 | 42 | 43 | NTSC 1.02 44 | # Calculate tangent of angle in f1 45 | # --- args: 46 | # f1 = fAngle 47 | 48 | # --- returns: 49 | # f1 = fTan 50 | b 0x803261bc 51 | 52 | 53 | 54 | 55 | NTSC 1.02 56 | # Calculate arcsine of angle in f1 57 | # --- args: 58 | # f1 = fAngle 59 | 60 | # --- returns: 61 | # f1 = fAsin 62 | b 0x80022dbc 63 | 64 | 65 | 66 | NTSC 1.02 67 | # Calculate arccosine of angle in f1 68 | # --- args: 69 | # f1 = fAngle 70 | 71 | # --- returns: 72 | # f1 = fAcos 73 | b 0x80022d1c 74 | 75 | 76 | 77 | NTSC 1.02 78 | # Calculate arctangent of angle in f1 79 | # --- args: 80 | # f1 = fAngle 81 | 82 | # --- returns: 83 | # f1 = fAtan 84 | b 0x80022e68 85 | 86 | 87 | 88 | NTSC 1.02 89 | # Calculate atan2 of f1 90 | # --- args: 91 | # f1 = fY 92 | # f2 = fX 93 | 94 | # --- returns: 95 | # f1 = fAtan2 96 | b 0x80022c30 97 | 98 | -------------------------------------------------------------------------------- /Mods Library/_funcs/Misc/Audio.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | Sound Effect Functions 4 | 5 | sfx.play # play a sound effect at normal volume, using a full ID 6 | args: rSFX 7 | [Punkline] 8 | NTSC 1.02 9 | # Play a sound effect 10 | 11 | # --- args: 12 | # r3 = SFX ID 13 | 388000FE 38A00080 38C00000 38E00007 14 | b 0x8038cff4 15 | -------------------------------------------------------------------------------- /Mods Library/_funcs/Misc/Logger/Operations.txt: -------------------------------------------------------------------------------- 1 | -==- 2 | 3 | Dolphin Logger Functions 4 | 5 | log.print # print ascii to Dolphin Log 'OSReport' output 6 | args: rString, rArg1, rArg2, rArg3 ... 7 | # - printed lines are formatted with the following escapes 8 | # - FPRS: %f = float, %e = exponent 9 | # - GPRS: %s = str, %x = hex, %d, %i = signed decimal 10 | # - GPRS: %u = unsigned decimal, %\x23\ x = prefixed hex 11 | # - GPRS: %\x23\ 04x = 4-digits of hex, including prefix 12 | # - printed lines must be 1024 chars or less 13 | # - printed lines will flood stdout and obfuscate error messages 14 | 15 | log.nl # Print a null message to give appearence of newline 16 | 17 | log.timestamp # returns details about current frame/time 18 | returns: rScene, rRel, rBoot, rID, rTrans, rMajor, rMinor, rTBU, rTBL, fScene, fRel, fBoot 19 | # takes no args, and returns the following identifying timestamp data: 20 | # --- Retrns: 21 | # f1 = Scene frame 22 | # - integer index counter -- not a real timer 23 | # - index counts up once before the GProc, GXDraw steps in a scene frame execute 24 | # - updated as part of the HSD Performance stat routine implemented in the scene loop 25 | # f2 = Relative frame 26 | # - using HSD Performance stat timestamps 27 | # - f2 is the real time relative to the start of the counted frame in f1 28 | # - very accurate -- should maintain precision of 20-nanosecond increments 29 | # f3 = Boot frame 30 | # - using OS boot timestamp to create a sample runtime frame timestamp 31 | 32 | # r3 = Scene frame 33 | # r4 = Relative frame (in microframes) 34 | # + FFF00000 = full frames 35 | # + 000FFFFF = microframes 36 | # - microframes count in-between frames, relative to the performance monitor timestamps 37 | # - full frames will be <1 unless something is causing the scene frame ticks to stall: 38 | # - >1 when the GProc or GXDraw step of a scene takes too long 39 | # - >1 when the CPU is stalling while waiting for hardware to sync 40 | # r5 = Boot frame 41 | 42 | # r6 = compressed ID: [r7, r8, r9] 43 | # - r6 is convenient for implementing into timestamp messages if individual IDs are not needed 44 | # r7 = Scene Transition Count 45 | # r8 = Major Scene ID 46 | # r9 = Minor Scene ID 47 | # r10, r11 = raw TBU, TBL 48 | # - r10, r11 make a timestamp counting from epoch in jan 2000 -- unnormalized 49 | 50 | [Punkline] 51 | # --- generic tools: 52 | 53 | NTSC 1.02 54 | # This logs a formatted print message in the Dolphin logger, and can use floating point args 55 | # - log messages will flood EXI buffer with ascii, obfuscating some error outputs in the game 56 | 57 | # --- args: 58 | # r3 = address of format string 59 | # - string MUST begin with a space, and may include escapes for inserting formatted arguments 60 | # - FPR escapes: %f = float, %e = exponent 61 | # - GPR escapes: %s = str, %x = hex, %d, %i = signed decimal, %u = unsigned decimal 62 | # - %\x23\ x -- this format makes hex with a prefix '0x' 63 | # - 64 | # r4...r10 = GPR arguments 65 | # f1...f8 = FPR arguments 66 | # - these will be fed into the escapes found in the format string, as needed 67 | 4CC63342 68 | b 0x80323eb4 69 | 70 | 71 | 72 | 73 | # Prints a null message to give the appearence of a newline without emitting one 74 | 7C0802A6 9421FFE0 90010024 38000000 90010010 38610010 75 | bl 76 | 80010024 38210020 7C0803A6 4E800020 77 | 78 | 79 | NTSC 1.02 80 | # takes no args, and returns the following identifying timestamp data: 81 | # --- Retrns: 82 | # f1 = Scene frame 83 | # - integer index counter -- not a real timer 84 | # - index counts up once before the GProc, GXDraw steps in a scene frame execute 85 | # - updated as part of the HSD Performance stat routine implemented in the scene loop 86 | # f2 = Relative frame 87 | # - using HSD Performance stat timestamps 88 | # - f2 is the real time relative to the start of the counted frame in f1 89 | # - very accurate -- should maintain precision of 20-nanosecond increments 90 | # f3 = Boot frame 91 | # - using OS boot timestamp to create a sample runtime frame timestamp 92 | 93 | # r3 = Scene frame 94 | # r4 = Relative frame (in microframes) 95 | # + FFF00000 = full frames 96 | # + 000FFFFF = microframes 97 | # - microframes count in-between frames, relative to the performance monitor timestamps 98 | # - full frames will be <1 unless something is causing the scene frame ticks to stall: 99 | # - >1 when the GProc or GXDraw step of a scene takes too long 100 | # - >1 when the CPU is stalling while waiting for hardware to sync 101 | # r5 = Boot frame 102 | 103 | # r6 = compressed ID: [r7, r8, r9] 104 | # - r6 is convenient for implementing into timestamp messages if individual IDs are not needed 105 | # r7 = Scene Transition Count 106 | # r8 = Major Scene ID 107 | # r9 = Minor Scene ID 108 | # r10, r11 = raw TBU, TBL 109 | # - r10, r11 make a timestamp counting from epoch in jan 2000 -- unnormalized 110 | 7D4D42E6 7D6C42E6 7C0D42E6 7C005000 40A2FFF0 7C0802A6 9421FFD0 90010034 DBE10020 3CE08000 80C700F8 3C008888 54C6F0BE 60008889 7C603016 3880FFFB 111 | bl 112 | FFE00890 806730D8 808730DC 7C845810 7C635110 113 | bl 114 | FC21F824 D021000C 115 | bl 116 | 7C651B78 806DC058 2C030000 808DC05C 41820014 7C845810 7C635110 117 | bl 118 | FC21F824 D0210010 38600014 119 | bl 120 | 90610014 3D008048 80689D5C 121 | bl 122 | 80810014 C0410010 C061000C 3CE08043 89289D33 80E720CC 89089D30 54E6801E 5106442E 5126063E CBE10020 80010034 38210030 7C0803A6 4E800020 123 | -------------------------------------------------------------------------------- /Mods Library/_funcs/Misc/Logger/Utilities.txt: -------------------------------------------------------------------------------- 1 | 2 | -==- 3 | 4 | Memory Info Logger 5 | 6 | log.mem.info # print info about a query input 7 | args: rArg # - arg can be a memory region ID or an address 8 | [Punkline] 9 | NTSC 1.02 10 | 7C0802A6 9421FFA0 90010064 7C000026 90010030 BEE10034 480001B4 4E800021 204D656D 44657363 5B25785D 202D2D20 54595045 3A202573 20257320 20204445 53433A20 25387820 20205354 4152543A 20253878 20202054 4F54414C 3A202523 20387820 62797465 73002048 45415000 43414348 45004672 65652020 20202000 416C6C6F 63617465 64002020 20257320 20204652 4147533A 20252320 38782020 20424947 47455354 3A202538 78202825 23203878 20627974 65732920 20544F54 414C3A20 25232038 78206279 74657300 4452414D 00535241 4D00204D 656D4465 73635B25 785D202D 2D204E4F 54204143 54495645 00204D65 6D446573 635B2578 5D202D2D 20257320 3A202538 78202020 53544152 543A2025 38782020 2053495A 453A2025 23203130 78202020 4F464653 45543A20 25232031 30782020 20515545 52593A20 25387800 20537461 74696320 25357320 2D2D2053 54415254 3A202538 78202020 51554552 593A2025 38782020 204F4646 5345543A 20252320 31307800 20282538 78206973 206E6F74 20612076 616C6964 20717565 72793B20 75736520 61204452 414D2F53 52414D20 61646472 65737320 6F722061 204D656D 44657363 20494420 302E2E2E 35290000 4BFFFE51 7FE802A6 7C7D1B78 11 | bl 12 | 2D1D0000 7C9B2379 7C7C1B78 40880060 41A40030 2D8B0000 418C0010 387F0160 7FA4EB78 480000F8 7D655B78 7D846378 387F0128 7FA6EB78 7CE53050 480000E0 7D27E850 38BF0050 40A6000C 38BF004A 7CA62B78 7CE73B78 7D084378 387F00D5 7F84E378 7FAAEB78 480000B4 41A00018 2C1C0005 41A1FFA8 7F84E378 387F00BA 4800009C 2D080000 2D8B0000 7D194378 7D785B78 3AE10010 7CF7C5AA 41860014 3BDF0050 408C0008 830B0008 48000018 3BDF004A 40880008 83280008 408C0008 830B0008 7C872378 81070008 8127000C 38BF00B5 40A50008 38BF00B0 7FC6F378 7F84E378 387F0000 13 | bl 14 | 387F006A 389F0056 7CB764AA 7CE83B78 7F27CB78 15 | bl 16 | 387F006A 3AF7000C 389F0060 7CB764AA 7CE83B78 7F07C378 17 | bl 18 | bl 19 | BAE10034 80010030 7C0FF120 80010064 38210060 7C0803A6 4E800020 20 | -------------------------------------------------------------------------------- /Mods Library/_funcs/Misc/Visual/GX.txt: -------------------------------------------------------------------------------- 1 | GX Functions 2 | 3 | GX.setColorUpdate -- enable/disable writing results to Environmental Frame color/alpha Buffers 4 | # --- args: 5 | # r3 = GXBool update_enable 6 | 7 | GX.setAlphaUpdate -- enable/disable writing results to Environmental Frame alpha Buffers 8 | # --- args: 9 | # r3 = GXBool update_enable 10 | 11 | GX.setBlendMode -- Determines how the pixel color combines with the Environmental Frame Buffer 12 | # - the pixel color is the "Source" color (from TEV stages like this + Fog) 13 | # - the EFB is the "Destination" color 14 | # --- args: 15 | # r3 = GXBlendMode type 16 | # r4 = GXBlendFactor src_factor 17 | # r5 = GXBlendFactor dst_factor 18 | # r6 = GXLogicOp op 19 | 20 | GX.setAlphaCompare -- Resulting comparison is applied to the alpha of the last TEV stage 21 | # --- args: 22 | # r3 = GXCompare comp0 23 | # r4 = byte ref0 24 | # r5 = GXAlphaOp op 25 | # r6 = GXCompare comp1 26 | # r7 = byte ref1 27 | 28 | GX.setZMode -- Controls how the Z buffer is updated 29 | # --- args: 30 | # r3 = GXBool compare_enable 31 | # r4 = GXCompare func 32 | # r5 = GXBool update_enable 33 | 34 | GX.setZCompLoc -- Controls when Z comparison is made -- before or after texturing 35 | # - before is faster, but may cause alpha texturing blending issues 36 | # --- args: 37 | # r3 = GXBool before_tex 38 | 39 | GX.setNumTexGens -- For texture coords 40 | # --- args: 41 | # r3 = byte nTexGens 42 | 43 | GX.setNumTevStages -- Sets the number of TEV Stages for this drawing 44 | # - each TEV stage independently controls the color and alpha components in the TEV hardware 45 | # --- args: 46 | # r3 = byte nStages 47 | 48 | GX.setTevOrder -- Assigns a texture coord (tile ID), texture map (texture), and a color ID to a TEV stage 49 | # - 0xFF is a null input 50 | # --- args: 51 | # r3 = GXTevStageID stage 52 | # r4 = GXTevCoordID coord 53 | # r5 = GXTexMapID map 54 | # r6 = GXChannelID color 55 | 56 | GX.setTevOp -- A shortcut for calling GXSetTevColorIn, GXSetTevAlphaIn, GXSetTevColorOp, and GXSetTevAlphaOp 57 | # - modes: GX_MODULATE, GX_DECAL, GX_BLEND, GX_REPLACE 58 | # --- args: 59 | # r3 = GXTevStageID id 60 | # r4 = GXTevMode mode 61 | 62 | GX.setNumChans -- Set number of colors (for light?) 63 | # --- args: 64 | # r3 = byte nChans 65 | 66 | GX.setChanCtrl -- 67 | # - if disabled, material color is unmodified on rasterization 68 | # - if enabled, material color is transformed by lights enabled in light_mask 69 | # - if enabled, attn_fn and diff_fn can be used to control the angle and diffusion of attenuation 70 | # - if mat_src, material color comes from the vertex color instead of the material register 71 | # --- args: 72 | # r3 = GXChannelID chan 73 | # r4 = GXBool enable 74 | # r5 = GXColorSrc amb_src 75 | # r6 = GXColorSrc mat_src 76 | # r7 = GXLigtID light_mask 77 | # r8 = GXDiffuseFn diff_fn 78 | # r9 = GXAttnFn attn_fn 79 | 80 | GX.setCullMode -- Control whether front and/or back facing triangles should be drawn 81 | # --- args: 82 | # r3 = GXCullMode mode 83 | 84 | 85 | GX.clearVtxDesc -- Clears the current vertex attribute format so that new attributes can be defined 86 | 87 | GX.setVtxAttrFmt -- Set attribute format 88 | # r3 = GXVtxFmt vtxfmt (0...7) 89 | # r4 = GXAttr attr (GX_VA_POS = 9) 90 | # r5 = GXCompCnt cnt (GX_POS_XYZ = 1) 91 | # r6 = GXCompType type (GX_F32 = 4) 92 | # r7 = byte frac (fixed point mantissa bit size) 93 | # EX: 94 | 95 | # - attr = 9 (GX_VA_POS) 96 | # - cnt: XY, XYZ 97 | # - type: U8, S8, U16, S16, F32 98 | # - integer types can use frac param to set a mantissa bit size 99 | 100 | # - attr = 11 (GX_VA_CLR0) 101 | # - cnt: RGB, RGBA 102 | # - type: RGB565, RGB8, RGBX8, RGBA4, RGBA6, RGBA8 103 | 104 | GX.setVtxDesc -- Set the type of a single attribute in the current vertex descriptor 105 | # r3 = GXAttr attr (GX_VA_COLOR0) 106 | # r4 = GXVTXAttrIn type (GX_INDEX16) 107 | # - type: NONE, INDEX8, INDEX16, DIRECT 108 | 109 | GX.loadPosMtxImm -- Load a 3x4 modelview matrix into memory at location `pnidx` 110 | # r3 = GXMtx3x4 mtx (address) 111 | # r4 = GXPNIdx pnidx (GX_PNMTX0) 112 | 113 | GX.setCurrentMtx -- Selects a specific matrix from PNMTX slots to use for transformations 114 | # r3 = GXPNIdx pnidx (GX_PNMTX0) 115 | 116 | GX.begin -- Start input stream for describing vertices 117 | # r3 = 118 | 119 | GX.setAmbColor -- Set Ambient color, for light 120 | # r3 = color channel ID 121 | # r4 = color (address of RGBA) 122 | 123 | GX.setMatColor -- set Material color, for tev stages 124 | # r3 = color channel ID 125 | # r4 = color (address of RGBA) 126 | 127 | GX.setArray -- Set an array of indexed attributes, for vertex inputs 128 | # r3 = attribute ID 129 | # r4 = attribute array (RAM address) 130 | # r5 = stride (number of bytes per attribute) 131 | 132 | GX.invalidateParams -- 133 | # --- args: 134 | # r3 = unk (use -1) 135 | 136 | 137 | 138 | [GX] 139 | NTSC 1.02 140 | b 0x80340d40 141 | NTSC 1.02 142 | b 0x80340d80 143 | NTSC 1.02 144 | b 0x80340c3c 145 | NTSC 1.02 146 | b 0x8034051c 147 | NTSC 1.02 148 | b 0x80340dc0 149 | NTSC 1.02 150 | b 0x80340e38 151 | NTSC 1.02 152 | b 0x8033cb78 153 | NTSC 1.02 154 | b 0x80340790 155 | NTSC 1.02 156 | b 0x803405f0 157 | NTSC 1.02 158 | b 0x8033fdc4 159 | NTSC 1.02 160 | b 0x8033e55c 161 | NTSC 1.02 162 | b 0x8033e5a8 163 | NTSC 1.02 164 | b 0x8033d350 165 | NTSC 1.02 166 | b 0x8033C3C8 167 | NTSC 1.02 168 | b 0x8033C414 169 | NTSC 1.02 170 | b 0x80361fc4 171 | NTSC 1.02 172 | b 0x8033bf00 173 | NTSC 1.02 174 | b 0x80341494 175 | NTSC 1.02 176 | b 0x80341510 177 | NTSC 1.02 178 | b 0x8033d0dc 179 | NTSC 1.02 180 | b 0x8033e28c 181 | NTSC 1.02 182 | b 0x8033e3f4 183 | NTSC 1.02 184 | b 0x8033c80c 185 | NTSC 1.02 186 | b 0x8033D240 187 | NTSC 1.02 188 | b 0x8033d298 189 | -------------------------------------------------------------------------------- /Original DOLs/NTSC 1.00.dol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/Original DOLs/NTSC 1.00.dol -------------------------------------------------------------------------------- /Original DOLs/NTSC 1.01.dol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/Original DOLs/NTSC 1.01.dol -------------------------------------------------------------------------------- /Original DOLs/NTSC 1.02.dol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/Original DOLs/NTSC 1.02.dol -------------------------------------------------------------------------------- /Original DOLs/PAL 1.00.dol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/Original DOLs/PAL 1.00.dol -------------------------------------------------------------------------------- /Original DOLs/ReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | For any game or DOL that you'd like to work with, you should place a vanilla (original) copy of the 3 | DOL file in this folder. These original DOLs are used by the program to reference original game code, 4 | and are required for various functionality, such as region restoration (such as for some mod uninstallations), 5 | calculating RAM to DOL offsets across differing game revisions, and pulling original code when creating 6 | new mods. 7 | 8 | 9 | Files should follow this naming convention: "[region] [version].dol" 10 | 11 | E.g. "NTSC 1.02.dol" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Melee Code Manager (MCM) 2 | This is a program to manage the installation of code-based mods in GameCube/Wii games, using a simple and very easy to use interface, and desgined particularly for Super Smash Bros. Melee. This includes Gecko codes, but can also install static overwrites and injection mods without the need for a codehandler. Default game settings for SSBM can also easily be set, including settings that aren't normally saved between resets. The program can operate on an ISO/GCM disc directly, or a standalone DOL file. Also available are multiple useful tools, including an assembler, a DOL offset to RAM address converter, number converters, ASCII to Hex converters, an interface to help construct new code mods, and more. It also has a useful conflict detection feature, to warn about cases where mods would interfere with one another. 3 | 4 | Injection codes are installed to regions in the DOL marked as safe for overwriting. These custom code regions can be defined by opening and editing the settings.py file (which is available and still functional for edits even after the program is compiled). Many regions can be defined, and the actual ones used by the program can be set on a per-use basis by clicking on the "Code-Space Options" button in the program. 5 | 6 | In a sense this also "wraps" the assembly language, adding a few extra special syntaxes: Standalone Functions, Special Branch Syntaxes, and RAM Pointer Symbols. These allow codes to share code or data in non-redundant ways, without having to hardcode their locations. Their functionality and usage can be found [here](https://smashboards.com/threads/melee-code-manager-v4-3-easily-add-mods-to-your-game.416437/post-20075377). 7 | 8 | You can find the official thread for this program here: [Melee Code Manager on SmashBoards.com](https://smashboards.com/threads/melee-code-manager-v4-3-easily-add-mods-to-your-game.416437/) 9 | 10 | Disclaimer: the structure of this program's code is largely a very functional style (i.e. built mostly using just strait functions). Certainly some parts would be better suited as objects, with classes and their own personal methods, and I know there are some things that could be done more efficiently. A big reason for these things is the fact that this is a really old project, built when I was first learning Python. :P But going forward I'll be occasionally refactoring parts of this program, and rewriting key components of it as I incorporate them into future projects. Let me know if there's anything you'd like to see broken out into a separate project. 11 | 12 | ## Installation & Setup 13 | ### Windows 14 | In order to run or compile this program, you'll need to install Python 2 and a few modules. Any version of python between 2.7.12 up to the latest 2.7 should work. 15 | 16 | After installing Python, the following Python modules must be installed: 17 | 18 | - Pillow (internally referred to as PIL) 19 | - cx-Freeze (if you want to compile) 20 | 21 | The easiest way to install these is with pip, which comes with Python by default. It's found in C:\Python27\Scripts; which you'll need to navigate to if you didn't install Python to your PATH variable (which is an option when you install it). Once you're ready to run pip commands, you can install the above modules by running 'pip install [moduleName]' for each one. All other dependencies are included in the repo. 22 | 23 | cx-Freeze will need to be less than version 6 for compatibility with Python 2.7. I recommend v5.1.1, as that's what I've been using. To install this specific version, you can use "pip install cx-Freeze==5.1.1" 24 | 25 | ### Other OSes 26 | Running the program uncompiled on other platforms hasn't been tested yet. However, once compiled, MCM can be run on MacOS, Android, Ubuntu, and more using Wine. For platform and version compatibility of Wine, check [Wine's download page](https://wiki.winehq.org/Download). Homebrew can be used as a convenient package manager to install as Wine. Of course, running MCM within a VM (Virtual Machine) is also a viable option if this doesn't work for you. 27 | 28 | The following directions are for MacOS, however I haven't tested them myself, so please let me know if you find any mistakes or have any improvements. 29 | 30 | 1. Install Homebrew: open terminal and enter `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` 31 | 2. Enter `brew doctor` to make sure Homebrew is running well 32 | 3. Install wine by entering `brew install wine` 33 | 4. Install winetricks by entering `brew install winetricks` 34 | 5. Enter 'winetricks -q dotnet452 corefonts' to install .net frameworks 4.5.2 for Wine 35 | 6. Navigate to your MCM folder (you can use `cd` to enter a folder, and `ls` to see what folders you can enter) 36 | 7. Run `wine Melee\ Code\ Manager.exe` (spaces in folder and file names need to be escaped with backslashes) 37 | 38 | You can find a larger explanation and guide for installing Homebrew and Wine [here](https://www.davidbaumgold.com/tutorials/wine-mac/) (also includes making a dock icon), or try Google for more. 39 | 40 | ## Building (Windows) 41 | This program uses cx-Freeze to compile, using the setup.py file. To compile the program, you just need to run the "Build Executable.bat" batch script, which is a simple wrapper for setup.py. Once compiled, the program will be found in the 'build' folder, and will be renamed to 'Melee Code Manager - v[version] ([x86|x64])'. 42 | -------------------------------------------------------------------------------- /appIcon1.3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/appIcon1.3.ico -------------------------------------------------------------------------------- /bin/codehandler.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/bin/codehandler.bin -------------------------------------------------------------------------------- /bin/eabi/powerpc-eabi-as.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/bin/eabi/powerpc-eabi-as.exe -------------------------------------------------------------------------------- /bin/eabi/powerpc-eabi-ld.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/bin/eabi/powerpc-eabi-ld.exe -------------------------------------------------------------------------------- /bin/eabi/powerpc-eabi-objcopy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/bin/eabi/powerpc-eabi-objcopy.exe -------------------------------------------------------------------------------- /bin/eabi/vdappc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/bin/eabi/vdappc.exe -------------------------------------------------------------------------------- /defaultOptions.ini: -------------------------------------------------------------------------------- 1 | [Region Overwrite Settings] 2 | Common Code Regions = True 3 | 20XXHP 4.07 Regions = False 4 | 20XXHP 5.0 Regions = False 5 | Tournament Mode Region, P1 = True 6 | Tournament Mode Region, P2 = True 7 | Screenshot Regions = True 8 | Debug Mode Region = False 9 | Aux Code Regions = False 10 | EnableGeckoCodes = False 11 | -------------------------------------------------------------------------------- /imgs/Bowser2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/Bowser2.png -------------------------------------------------------------------------------- /imgs/appIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/appIcon.png -------------------------------------------------------------------------------- /imgs/bobombWalking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/bobombWalking.png -------------------------------------------------------------------------------- /imgs/bobombsSitting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/bobombsSitting.png -------------------------------------------------------------------------------- /imgs/books.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/books.png -------------------------------------------------------------------------------- /imgs/editButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/editButton.png -------------------------------------------------------------------------------- /imgs/editButtonGray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/editButtonGray.png -------------------------------------------------------------------------------- /imgs/folderIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/folderIcon.png -------------------------------------------------------------------------------- /imgs/geckoIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/geckoIndicator.png -------------------------------------------------------------------------------- /imgs/githubLink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/githubLink.png -------------------------------------------------------------------------------- /imgs/githubLinkGray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/githubLinkGray.png -------------------------------------------------------------------------------- /imgs/injectionIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/injectionIndicator.png -------------------------------------------------------------------------------- /imgs/p1Indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/p1Indicator.png -------------------------------------------------------------------------------- /imgs/p2Indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/p2Indicator.png -------------------------------------------------------------------------------- /imgs/p3Indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/p3Indicator.png -------------------------------------------------------------------------------- /imgs/p4Indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/p4Indicator.png -------------------------------------------------------------------------------- /imgs/randall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/randall.png -------------------------------------------------------------------------------- /imgs/searchIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/searchIcon.png -------------------------------------------------------------------------------- /imgs/smashboardsLink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/smashboardsLink.png -------------------------------------------------------------------------------- /imgs/smashboardsLinkGray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/smashboardsLinkGray.png -------------------------------------------------------------------------------- /imgs/standaloneIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/standaloneIndicator.png -------------------------------------------------------------------------------- /imgs/staticIndicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/staticIndicator.png -------------------------------------------------------------------------------- /imgs/updateArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/updateArrow.png -------------------------------------------------------------------------------- /imgs/youtubeLink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/youtubeLink.png -------------------------------------------------------------------------------- /imgs/youtubeLinkGray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/imgs/youtubeLinkGray.png -------------------------------------------------------------------------------- /newTkDnD.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # This file's encoding: UTF-8 4 | # Source: https://stackoverflow.com/questions/14267900/python-drag-and-drop-explorer-files-to-tkinter-entry-widget 5 | # Modified by DRGN of Smashboards (Daniel R. Cappel) 6 | # Version 2.0 7 | 8 | from os import path 9 | import Tkinter, sys 10 | 11 | def _load_tkdnd(master): 12 | scriptHomeFolder = path.abspath( path.dirname(sys.argv[0]) ) 13 | 14 | # Determine what OS and python architecture are in use 15 | if sys.maxsize > 2**32: # Environment is 64-bit 16 | tkdndlib = scriptHomeFolder + "\\tk\\tkdnd2.7\\x64" 17 | else: 18 | tkdndlib = scriptHomeFolder + "\\tk\\tkdnd2.7\\x86" 19 | 20 | if tkdndlib: 21 | master.tk.eval('global auto_path; lappend auto_path {%s}' % tkdndlib) 22 | master.tk.eval('package require tkdnd') 23 | master._tkdnd_loaded = True 24 | 25 | 26 | class TkDND(object): 27 | def __init__(self, master): 28 | if not getattr(master, '_tkdnd_loaded', False): 29 | _load_tkdnd(master) 30 | self.master = master 31 | self.tk = master.tk 32 | 33 | # Available pre-defined values for the 'dndtype' parameter: 34 | # text/plain 35 | # text/plain;charset=UTF-8 36 | # text/uri-list 37 | 38 | def bindtarget(self, window, callback, dndtype, event='', priority=50): 39 | cmd = self._prepare_tkdnd_func(callback) 40 | return self.tk.call('dnd', 'bindtarget', window, dndtype, event, 41 | cmd, priority) 42 | 43 | def bindtarget_query(self, window, dndtype=None, event=''): 44 | return self.tk.call('dnd', 'bindtarget', window, dndtype, event) 45 | 46 | def cleartarget(self, window): 47 | self.tk.call('dnd', 'cleartarget', window) 48 | 49 | 50 | def bindsource(self, window, callback, dndtype, priority=50): 51 | cmd = self._prepare_tkdnd_func(callback) 52 | self.tk.call('dnd', 'bindsource', window, dndtype, cmd, priority) 53 | 54 | def bindsource_query(self, window, dndtype=None): 55 | return self.tk.call('dnd', 'bindsource', window, dndtype) 56 | 57 | def clearsource(self, window): 58 | self.tk.call('dnd', 'clearsource', window) 59 | 60 | 61 | def drag(self, window, actions=None, descriptions=None, 62 | cursorwin=None, callback=None): 63 | cmd = None 64 | if cursorwin is not None: 65 | if callback is not None: 66 | cmd = self._prepare_tkdnd_func(callback) 67 | self.tk.call('dnd', 'drag', window, actions, descriptions, 68 | cursorwin, cmd) 69 | 70 | 71 | _subst_format = ('%A', '%a', '%b', '%D', '%d', '%m', '%T', 72 | '%W', '%X', '%Y', '%x', '%y') 73 | _subst_format_str = " ".join(_subst_format) 74 | 75 | def _prepare_tkdnd_func(self, callback): 76 | funcid = self.master.register(callback, self._dndsubstitute) 77 | cmd = ('%s %s' % (funcid, self._subst_format_str)) 78 | return cmd 79 | 80 | def _dndsubstitute(self, *args): 81 | if len(args) != len(self._subst_format): 82 | return args 83 | 84 | def try_int(x): 85 | x = str(x) 86 | try: 87 | return int(x) 88 | except ValueError: 89 | return x 90 | 91 | A, a, b, D, d, m, T, W, X, Y, x, y = args 92 | 93 | event = Tkinter.Event() 94 | event.action = A # Current action of the drag and drop operation. 95 | event.action_list = a # Action list supported by the drag source. 96 | event.mouse_button = b # Mouse button pressed during the drag and drop. 97 | event.data = D # The data that has been dropped. 98 | event.descr = d # The list of descriptions. 99 | event.modifier = m # The list of modifier keyboard keys pressed. 100 | event.dndtype = T 101 | event.widget = self.master.nametowidget(W) 102 | event.x_root = X # Mouse pointer x coord, relative to the root win. 103 | event.y_root = Y 104 | event.x = x # Mouse pointer x coord, relative to the widget. 105 | event.y = y 106 | 107 | event.action_list = str(event.action_list).split() 108 | for name in ('mouse_button', 'x', 'y', 'x_root', 'y_root'): 109 | setattr(event, name, try_int(getattr(event, name))) 110 | 111 | return (event, ) -------------------------------------------------------------------------------- /playsound.py: -------------------------------------------------------------------------------- 1 | # Original source found here: https://pypi.org/project/playsound/ 2 | # Modified from source by Daniel Cappel, to add: 3 | # - Volume control (on Windows machines) 4 | 5 | class PlaysoundException(Exception): 6 | pass 7 | 8 | def _playsoundWin(sound, block = True, volume = '1000'): 9 | ''' 10 | Utilizes windll.winmm (An MCI, "Media Control Interface)". 11 | Tested and known to work with MP3 and WAVE on 12 | Windows 7 with Python 2.7. Probably works with more file formats. 13 | Probably works on Windows XP thru Windows 10. Probably works with all 14 | versions of Python. 15 | 16 | Inspired by (but not copied from) Michael Gundlach 's mp3play: 17 | https://github.com/michaelgundlach/mp3play 18 | 19 | I never would have tried using windll.winmm without seeing his code. 20 | ''' 21 | from ctypes import c_buffer, windll 22 | from random import random 23 | from time import sleep 24 | from sys import getfilesystemencoding 25 | 26 | if isinstance( volume, str ) and '%' in volume: 27 | volInt = int( volume.replace('%', '') ) 28 | volString = str( volInt * 10 ) 29 | else: 30 | try: 31 | volInt = int( volume ) 32 | if volInt < 0 or volInt > 1000: 33 | raise Exception( 'Should be a percentage (e.g. 50%) or value between 0 and 1000' ) 34 | else: 35 | volString = str( volume ) 36 | except Exception as e: 37 | print 'Invalid volume argument;', e 38 | 39 | def winCommand(*command): 40 | buf = c_buffer(255) 41 | command = ' '.join(command).encode(getfilesystemencoding()) 42 | errorCode = int(windll.winmm.mciSendStringA(command, buf, 254, 0)) 43 | 44 | if errorCode: 45 | errorBuffer = c_buffer(255) 46 | windll.winmm.mciGetErrorStringA(errorCode, errorBuffer, 254) 47 | exceptionMessage = ('\n Error ' + str(errorCode) + ' for command:' 48 | '\n ' + command.decode() + 49 | '\n ' + errorBuffer.value.decode()) 50 | raise PlaysoundException(exceptionMessage) 51 | else: print 'errorCode:', errorCode 52 | return buf.value 53 | 54 | 55 | alias = 'playsound_' + str(random()) 56 | winCommand('open "' + sound + '" alias', alias) 57 | #winCommand( alias + ' info' ) 58 | 59 | #import os 60 | #if os.path.splitext( sound )[1] == '.wav' 61 | try: # Seems to not work with [some?] wav files. What else doesn't it work for? 62 | winCommand('setaudio', alias, 'volume to', volString ) 63 | except: pass 64 | winCommand('set', alias, 'time format milliseconds') 65 | durationInMS = winCommand('status', alias, 'length') 66 | winCommand('play', alias, 'from 0 to', durationInMS.decode()) 67 | 68 | if block: 69 | sleep(float(durationInMS) / 1000.0) 70 | 71 | def _playsoundOSX(sound, block = True, volume = '1000'): 72 | ''' 73 | Utilizes AppKit.NSSound. Tested and known to work with MP3 and WAVE on 74 | OS X 10.11 with Python 2.7. Probably works with anything QuickTime supports. 75 | Probably works on OS X 10.5 and newer. Probably works with all versions of 76 | Python. 77 | 78 | Inspired by (but not copied from) Aaron's Stack Overflow answer here: 79 | http://stackoverflow.com/a/34568298/901641 80 | 81 | I never would have tried using AppKit.NSSound without seeing his code. 82 | ''' 83 | from AppKit import NSSound 84 | from Foundation import NSURL 85 | from time import sleep 86 | 87 | if '://' not in sound: 88 | if not sound.startswith('/'): 89 | from os import getcwd 90 | sound = getcwd() + '/' + sound 91 | sound = 'file://' + sound 92 | url = NSURL.URLWithString_(sound) 93 | nssound = NSSound.alloc().initWithContentsOfURL_byReference_(url, True) 94 | if not nssound: 95 | raise IOError('Unable to load sound named: ' + sound) 96 | nssound.play() 97 | 98 | if block: 99 | sleep(nssound.duration()) 100 | 101 | def _playsoundNix(sound, block = True, volume = '1000'): 102 | """Play a sound using GStreamer. 103 | 104 | Inspired by this: 105 | https://gstreamer.freedesktop.org/documentation/tutorials/playback/playbin-usage.html 106 | """ 107 | if not block: 108 | raise NotImplementedError( 109 | "block=False cannot be used on this platform yet") 110 | 111 | # pathname2url escapes non-URL-safe characters 112 | import os 113 | try: 114 | from urllib.request import pathname2url 115 | except ImportError: 116 | # python 2 117 | from urllib import pathname2url 118 | 119 | import gi 120 | gi.require_version('Gst', '1.0') 121 | from gi.repository import Gst 122 | 123 | Gst.init(None) 124 | 125 | playbin = Gst.ElementFactory.make('playbin', 'playbin') 126 | if sound.startswith(('http://', 'https://')): 127 | playbin.props.uri = sound 128 | else: 129 | playbin.props.uri = 'file://' + pathname2url(os.path.abspath(sound)) 130 | 131 | set_result = playbin.set_state(Gst.State.PLAYING) 132 | if set_result != Gst.StateChangeReturn.ASYNC: 133 | raise PlaysoundException( 134 | "playbin.set_state returned " + repr(set_result)) 135 | 136 | # FIXME: use some other bus method than poll() with block=False 137 | # https://lazka.github.io/pgi-docs/#Gst-1.0/classes/Bus.html 138 | bus = playbin.get_bus() 139 | bus.poll(Gst.MessageType.EOS, Gst.CLOCK_TIME_NONE) 140 | playbin.set_state(Gst.State.NULL) 141 | 142 | 143 | from platform import system 144 | system = system() 145 | 146 | if system == 'Windows': 147 | playsound = _playsoundWin 148 | elif system == 'Darwin': 149 | playsound = _playsoundOSX 150 | else: 151 | playsound = _playsoundNix 152 | 153 | del system -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Created by Daniel Cappel ("DRGN") 2 | # Script version: 2.2 3 | 4 | from cx_Freeze import setup, Executable 5 | import sys, os 6 | 7 | programName = "Melee Code Manager" 8 | mainScript = __import__( "Melee Code Manager" ) # This import method is used in order to import a file with spaces in its name. 9 | preserveConsole = False # For the console to work, search for the string "logging output" in the main MCM script, and comment out the relevent code there. 10 | 11 | # Dependencies are automatically detected, but it might need fine tuning. 12 | 13 | buildOptions = dict( 14 | packages = [], 15 | excludes = [ 'settings' ], # Prevent from adding module to lib/library.zip, to read from lib/settings.py instead 16 | include_files = [ 17 | '.include', 18 | 'About.txt', 19 | 'bin', 20 | 'defaultOptions.ini', 21 | 'imgs', 22 | 'Mods Library', 23 | 'Original DOLs', 24 | 'settings.py', 25 | 'sfx', 26 | 'tk', # For drag 'n drop functionality. 27 | ]) 28 | 29 | if preserveConsole: 30 | base = 'Console' 31 | else: 32 | base = 'Win32GUI' if sys.platform == 'win32' else None 33 | 34 | # Determine platform architecture 35 | if sys.maxsize > 2**32: 36 | platformArchitecture = 'x64' 37 | else: 38 | platformArchitecture = 'x86' 39 | 40 | executables = [ 41 | Executable( 42 | "Melee Code Manager.py", 43 | icon='appIcon1.3.ico', 44 | base=base ) 45 | ] 46 | 47 | print 'Preparing setup....' 48 | 49 | # Normalize the version string for setup ('version' below must be a string, with only numbers or dots) 50 | simpleVersion = '.'.join( [char for char in mainScript.programVersion.split('.') if char.isdigit()] ) 51 | 52 | setup( 53 | name = programName, 54 | version = simpleVersion, 55 | description = 'DOL Modding Program for GameCube and Wii Games.', 56 | options = dict( build_exe = buildOptions ), 57 | executables = executables 58 | ) 59 | 60 | # Perform file/folder renames 61 | print '\n' 62 | print 'Main script version: ', mainScript.programVersion 63 | print 'Simplified version: ', simpleVersion 64 | print 'Platform architecture: ', platformArchitecture 65 | 66 | # Get the name of the new program folder that will be created in '\build\' 67 | scriptHomeFolder = os.path.abspath( os.path.dirname(__file__) ) 68 | buildFolder = os.path.join( scriptHomeFolder, 'build' ) 69 | builtProgramFolder = '' 70 | for directory in os.listdir( buildFolder ): 71 | if directory.startswith( 'exe.' ): # e.g. "exe.win-amd64-2.7" 72 | builtProgramFolder = os.path.join( buildFolder, directory ) 73 | break 74 | else: # The loop above didn't break 75 | print 'Unable to locate the new program folder!' 76 | sys.exit( 2 ) 77 | 78 | # Delete extra (test) .include items 79 | #keepTheseIncludes = ( 'CommonMCM.s', 'punkpc' ) # Files other than these in the new .include folder will be deleted (assumed to be test files) 80 | # try: 81 | # rootIncludeFolder = os.path.join( builtProgramFolder, '.include' ) 82 | # for item in os.listdir( rootIncludeFolder ): 83 | # if item not in keepTheseIncludes: 84 | # os.remove( os.path.join( rootIncludeFolder, item ) ) 85 | # print '\nRemoved test .include files' 86 | # except Exception as err: 87 | # print '\nUnable to remove test .include files.' # <- Access is denied?? 88 | # print err 89 | 90 | # Rename the default options (.ini) file 91 | os.rename( builtProgramFolder + '\\defaultOptions.ini', builtProgramFolder + '\\options.ini' ) 92 | 93 | # Create a new name for the progam folder (ensuring it's unique) and rename it 94 | newProgramFolderName = '{} - v{} ({})'.format( programName, mainScript.programVersion, platformArchitecture ) 95 | newProgramFolderPath = os.path.join( buildFolder, newProgramFolderName ) 96 | i = 2 97 | while os.path.exists( newProgramFolderPath ): 98 | newProgramFolderPath = os.path.join( buildFolder, newProgramFolderName + ' ' + str( i ) ) 99 | i += 1 100 | os.rename( builtProgramFolder, newProgramFolderPath ) 101 | print 'Program folder renamed to "{}"'.format( newProgramFolderName ) 102 | 103 | # Move the settings.py configuration file to the lib folder 104 | source = os.path.join( newProgramFolderPath, 'settings.py' ) 105 | destination = os.path.join( newProgramFolderPath, 'lib', 'settings.py' ) 106 | os.rename( source, destination ) -------------------------------------------------------------------------------- /sfx/menuBack.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/sfx/menuBack.wav -------------------------------------------------------------------------------- /sfx/menuChange.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/sfx/menuChange.wav -------------------------------------------------------------------------------- /sfx/menuSelect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/sfx/menuSelect.wav -------------------------------------------------------------------------------- /tk/tkdnd2.7/x64/libtkdnd2.7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/tk/tkdnd2.7/x64/libtkdnd2.7.dll -------------------------------------------------------------------------------- /tk/tkdnd2.7/x64/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | package ifneeded tkdnd 2.7 \ 2 | "source \{$dir/tkdnd.tcl\} ; \ 3 | tkdnd::initialise \{$dir\} libtkdnd2.7[info sharedlibextension] tkdnd" -------------------------------------------------------------------------------- /tk/tkdnd2.7/x64/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag $window "press" 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | ::tkdnd::drag_source register $window $type 2 142 | bind $window <> "list {copy} %t \[$script\]" 143 | };# compat::bindsource2 144 | 145 | proc compat::bindsource3 {window type script priority} { 146 | return [bindsource2 $window $type $script] 147 | };# compat::bindsource3 148 | 149 | # ---------------------------------------------------------------------------- 150 | # Command compat::cleartarget 151 | # ---------------------------------------------------------------------------- 152 | proc compat::cleartarget {window} { 153 | };# compat::cleartarget 154 | 155 | # ---------------------------------------------------------------------------- 156 | # Command compat::clearsource 157 | # ---------------------------------------------------------------------------- 158 | proc compat::clearsource {window} { 159 | };# compat::clearsource 160 | -------------------------------------------------------------------------------- /tk/tkdnd2.7/x64/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | NSFilenamesPboardType DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 76 | $_actionlist $_pressedkeys 77 | };# macdnd::HandleEnter 78 | 79 | # ---------------------------------------------------------------------------- 80 | # Command macdnd::HandlePosition 81 | # ---------------------------------------------------------------------------- 82 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 83 | variable _pressedkeys 84 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 85 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 86 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 87 | $_pressedkeys $rootX $rootY 88 | };# macdnd::HandlePosition 89 | 90 | # ---------------------------------------------------------------------------- 91 | # Command macdnd::HandleLeave 92 | # ---------------------------------------------------------------------------- 93 | proc macdnd::HandleLeave { args } { 94 | ::tkdnd::generic::HandleLeave 95 | };# macdnd::HandleLeave 96 | 97 | # ---------------------------------------------------------------------------- 98 | # Command macdnd::HandleDrop 99 | # ---------------------------------------------------------------------------- 100 | proc macdnd::HandleDrop { drop_target data args } { 101 | variable _pressedkeys 102 | variable _last_mouse_root_x 103 | variable _last_mouse_root_y 104 | ## Get the dropped data... 105 | ::tkdnd::generic::SetDroppedData $data 106 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 107 | $_last_mouse_root_x $_last_mouse_root_y 0 108 | };# macdnd::HandleDrop 109 | 110 | # ---------------------------------------------------------------------------- 111 | # Command macdnd::GetDragSourceCommonTypes 112 | # ---------------------------------------------------------------------------- 113 | proc macdnd::GetDragSourceCommonTypes { } { 114 | ::tkdnd::generic::GetDragSourceCommonTypes 115 | };# macdnd::GetDragSourceCommonTypes 116 | 117 | # ---------------------------------------------------------------------------- 118 | # Command macdnd::platform_specific_types 119 | # ---------------------------------------------------------------------------- 120 | proc macdnd::platform_specific_types { types } { 121 | ::tkdnd::generic::platform_specific_types $types 122 | }; # macdnd::platform_specific_types 123 | 124 | # ---------------------------------------------------------------------------- 125 | # Command macdnd::platform_specific_type 126 | # ---------------------------------------------------------------------------- 127 | proc macdnd::platform_specific_type { type } { 128 | ::tkdnd::generic::platform_specific_type $type 129 | }; # macdnd::platform_specific_type 130 | 131 | # ---------------------------------------------------------------------------- 132 | # Command tkdnd::platform_independent_types 133 | # ---------------------------------------------------------------------------- 134 | proc ::tkdnd::platform_independent_types { types } { 135 | ::tkdnd::generic::platform_independent_types $types 136 | }; # tkdnd::platform_independent_types 137 | 138 | # ---------------------------------------------------------------------------- 139 | # Command macdnd::platform_independent_type 140 | # ---------------------------------------------------------------------------- 141 | proc macdnd::platform_independent_type { type } { 142 | ::tkdnd::generic::platform_independent_type $type 143 | }; # macdnd::platform_independent_type 144 | -------------------------------------------------------------------------------- /tk/tkdnd2.7/x64/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | FileGroupDescriptor DND_Files \ 48 | FileGroupDescriptorW DND_Files \ 49 | CF_HTML DND_HTML \ 50 | {HTML Format} DND_HTML \ 51 | CF_RTF DND_RTF \ 52 | CF_RTFTEXT DND_RTF \ 53 | {Rich Text Format} DND_RTF \ 54 | ] 55 | 56 | ## Mapping from TkDND types to platform types... 57 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 58 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 59 | DND_Files {CF_HDROP} \ 60 | DND_HTML {CF_HTML {HTML Format}} \ 61 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace olednd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command olednd::HandleDragEnter 69 | # ---------------------------------------------------------------------------- 70 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 71 | rootX rootY codelist } { 72 | focus $drop_target 73 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 74 | $codelist $actionlist $pressedkeys 75 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 76 | $pressedkeys $rootX $rootY] 77 | if {$::tkdnd::_auto_update} {update} 78 | return $action 79 | };# olednd::HandleDragEnter 80 | 81 | # ---------------------------------------------------------------------------- 82 | # Command olednd::HandleDragOver 83 | # ---------------------------------------------------------------------------- 84 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 85 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 86 | $pressedkeys $rootX $rootY] 87 | if {$::tkdnd::_auto_update} {update} 88 | return $action 89 | };# olednd::HandleDragOver 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command olednd::HandleDragLeave 93 | # ---------------------------------------------------------------------------- 94 | proc olednd::HandleDragLeave { drop_target } { 95 | ::tkdnd::generic::HandleLeave 96 | if {$::tkdnd::_auto_update} {update} 97 | };# olednd::HandleDragLeave 98 | 99 | # ---------------------------------------------------------------------------- 100 | # Command olednd::HandleXdndDrop 101 | # ---------------------------------------------------------------------------- 102 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 103 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 104 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 105 | $pressedkeys $rootX $rootY 0] 106 | if {$::tkdnd::_auto_update} {update} 107 | return $action 108 | };# olednd::HandleXdndDrop 109 | 110 | # ---------------------------------------------------------------------------- 111 | # Command olednd::GetDragSourceCommonTypes 112 | # ---------------------------------------------------------------------------- 113 | proc olednd::GetDragSourceCommonTypes { drop_target } { 114 | ::tkdnd::generic::GetDragSourceCommonTypes 115 | };# olednd::GetDragSourceCommonTypes 116 | 117 | # ---------------------------------------------------------------------------- 118 | # Command olednd::platform_specific_types 119 | # ---------------------------------------------------------------------------- 120 | proc olednd::platform_specific_types { types } { 121 | ::tkdnd::generic::platform_specific_types $types 122 | }; # olednd::platform_specific_types 123 | 124 | # ---------------------------------------------------------------------------- 125 | # Command olednd::platform_specific_type 126 | # ---------------------------------------------------------------------------- 127 | proc olednd::platform_specific_type { type } { 128 | ::tkdnd::generic::platform_specific_type $type 129 | }; # olednd::platform_specific_type 130 | 131 | # ---------------------------------------------------------------------------- 132 | # Command tkdnd::platform_independent_types 133 | # ---------------------------------------------------------------------------- 134 | proc ::tkdnd::platform_independent_types { types } { 135 | ::tkdnd::generic::platform_independent_types $types 136 | }; # tkdnd::platform_independent_types 137 | 138 | # ---------------------------------------------------------------------------- 139 | # Command olednd::platform_independent_type 140 | # ---------------------------------------------------------------------------- 141 | proc olednd::platform_independent_type { type } { 142 | ::tkdnd::generic::platform_independent_type $type 143 | }; # olednd::platform_independent_type 144 | 145 | # ---------------------------------------------------------------------------- 146 | # Command olednd::normalise_data 147 | # ---------------------------------------------------------------------------- 148 | proc olednd::normalise_data { type data } { 149 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 150 | DND_Text {return $data} 151 | DND_Files {return $data} 152 | DND_HTML {return [encoding convertfrom utf-8 $data]} 153 | default {return $data} 154 | } 155 | }; # olednd::normalise_data 156 | -------------------------------------------------------------------------------- /tk/tkdnd2.7/x86/libtkdnd2.7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DRGN-DRC/Melee-Code-Manager/563149d4b1c992a72f000f3c0625e01ca413738b/tk/tkdnd2.7/x86/libtkdnd2.7.dll -------------------------------------------------------------------------------- /tk/tkdnd2.7/x86/pkgIndex.tcl: -------------------------------------------------------------------------------- 1 | package ifneeded tkdnd 2.7 \ 2 | "source \{$dir/tkdnd.tcl\} ; \ 3 | tkdnd::initialise \{$dir\} libtkdnd2.7[info sharedlibextension] tkdnd" -------------------------------------------------------------------------------- /tk/tkdnd2.7/x86/tkdnd_compat.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_compat.tcl -- 3 | # 4 | # This file implements some utility procedures, to support older versions 5 | # of the TkDND package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval compat { 40 | 41 | };# namespace compat 42 | 43 | # ---------------------------------------------------------------------------- 44 | # Command ::dnd 45 | # ---------------------------------------------------------------------------- 46 | proc ::dnd {method window args} { 47 | switch $method { 48 | bindtarget { 49 | switch [llength $args] { 50 | 0 {return [tkdnd::compat::bindtarget0 $window]} 51 | 1 {return [tkdnd::compat::bindtarget1 $window [lindex $args 0]]} 52 | 2 {return [tkdnd::compat::bindtarget2 $window [lindex $args 0] \ 53 | [lindex $args 1]]} 54 | 3 {return [tkdnd::compat::bindtarget3 $window [lindex $args 0] \ 55 | [lindex $args 1] [lindex $args 2]]} 56 | 4 {return [tkdnd::compat::bindtarget4 $window [lindex $args 0] \ 57 | [lindex $args 1] [lindex $args 2] [lindex $args 3]]} 58 | } 59 | } 60 | cleartarget { 61 | return [tkdnd::compat::cleartarget $window] 62 | } 63 | bindsource { 64 | switch [llength $args] { 65 | 0 {return [tkdnd::compat::bindsource0 $window]} 66 | 1 {return [tkdnd::compat::bindsource1 $window [lindex $args 0]]} 67 | 2 {return [tkdnd::compat::bindsource2 $window [lindex $args 0] \ 68 | [lindex $args 1]]} 69 | 3 {return [tkdnd::compat::bindsource3 $window [lindex $args 0] \ 70 | [lindex $args 1] [lindex $args 2]]} 71 | } 72 | } 73 | clearsource { 74 | return [tkdnd::compat::clearsource $window] 75 | } 76 | drag { 77 | return [tkdnd::_init_drag $window "press" 0 0] 78 | } 79 | } 80 | error "invalid number of arguments!" 81 | };# ::dnd 82 | 83 | # ---------------------------------------------------------------------------- 84 | # Command compat::bindtarget 85 | # ---------------------------------------------------------------------------- 86 | proc compat::bindtarget0 {window} { 87 | return [bind $window <>] 88 | };# compat::bindtarget0 89 | 90 | proc compat::bindtarget1 {window type} { 91 | return [bindtarget2 $window $type ] 92 | };# compat::bindtarget1 93 | 94 | proc compat::bindtarget2 {window type event} { 95 | switch $event { 96 | {return [bind $window <>]} 97 | {return [bind $window <>]} 98 | {return [bind $window <>]} 99 | {return [bind $window <>]} 100 | } 101 | };# compat::bindtarget2 102 | 103 | proc compat::bindtarget3 {window type event script} { 104 | set type [normalise_type $type] 105 | ::tkdnd::drop_target register $window [list $type] 106 | switch $event { 107 | {return [bind $window <> $script]} 108 | {return [bind $window <> $script]} 109 | {return [bind $window <> $script]} 110 | {return [bind $window <> $script]} 111 | } 112 | };# compat::bindtarget3 113 | 114 | proc compat::bindtarget4 {window type event script priority} { 115 | return [bindtarget3 $window $type $event $script] 116 | };# compat::bindtarget4 117 | 118 | proc compat::normalise_type { type } { 119 | switch $type { 120 | text/plain - 121 | {text/plain;charset=UTF-8} - 122 | Text {return DND_Text} 123 | text/uri-list - 124 | Files {return DND_Files} 125 | default {return $type} 126 | } 127 | };# compat::normalise_type 128 | 129 | # ---------------------------------------------------------------------------- 130 | # Command compat::bindsource 131 | # ---------------------------------------------------------------------------- 132 | proc compat::bindsource0 {window} { 133 | return [bind $window <>] 134 | };# compat::bindsource0 135 | 136 | proc compat::bindsource1 {window type} { 137 | return [bindsource2 $window $type ] 138 | };# compat::bindsource1 139 | 140 | proc compat::bindsource2 {window type script} { 141 | ::tkdnd::drag_source register $window $type 2 142 | bind $window <> "list {copy} %t \[$script\]" 143 | };# compat::bindsource2 144 | 145 | proc compat::bindsource3 {window type script priority} { 146 | return [bindsource2 $window $type $script] 147 | };# compat::bindsource3 148 | 149 | # ---------------------------------------------------------------------------- 150 | # Command compat::cleartarget 151 | # ---------------------------------------------------------------------------- 152 | proc compat::cleartarget {window} { 153 | };# compat::cleartarget 154 | 155 | # ---------------------------------------------------------------------------- 156 | # Command compat::clearsource 157 | # ---------------------------------------------------------------------------- 158 | proc compat::clearsource {window} { 159 | };# compat::clearsource 160 | -------------------------------------------------------------------------------- /tk/tkdnd2.7/x86/tkdnd_macosx.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_macosx.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | 7 | # This software is copyrighted by: 8 | # Georgios Petasis, Athens, Greece. 9 | # e-mail: petasisg@yahoo.gr, petasis@iit.demokritos.gr 10 | # 11 | # Mac portions (c) 2009 Kevin Walzer/WordTech Communications LLC, 12 | # kw@codebykevin.com 13 | # 14 | # 15 | # The following terms apply to all files associated 16 | # with the software unless explicitly disclaimed in individual files. 17 | # 18 | # The authors hereby grant permission to use, copy, modify, distribute, 19 | # and license this software and its documentation for any purpose, provided 20 | # that existing copyright notices are retained in all copies and that this 21 | # notice is included verbatim in any distributions. No written agreement, 22 | # license, or royalty fee is required for any of the authorized uses. 23 | # Modifications to this software may be copyrighted by their authors 24 | # and need not follow the licensing terms described here, provided that 25 | # the new terms are clearly indicated on the first page of each file where 26 | # they apply. 27 | # 28 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 29 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 30 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 31 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 32 | # POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 35 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 36 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 37 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 38 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 39 | # MODIFICATIONS. 40 | # 41 | 42 | #basic API for Mac Drag and Drop 43 | 44 | #two data types supported: strings and file paths 45 | 46 | #two commands at C level: ::tkdnd::macdnd::registerdragwidget, ::tkdnd::macdnd::unregisterdragwidget 47 | 48 | #data retrieval mechanism: text or file paths are copied from drag clipboard to system clipboard and retrieved via [clipboard get]; array of file paths is converted to single tab-separated string, can be split into Tcl list 49 | 50 | if {[tk windowingsystem] eq "aqua" && "AppKit" ni [winfo server .]} { 51 | error {TkAqua Cocoa required} 52 | } 53 | 54 | namespace eval macdnd { 55 | 56 | proc initialise { } { 57 | ## Mapping from platform types to TkDND types... 58 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 59 | NSPasteboardTypeString DND_Text \ 60 | NSFilenamesPboardType DND_Files \ 61 | NSPasteboardTypeHTML DND_HTML \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace macdnd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command macdnd::HandleEnter 69 | # ---------------------------------------------------------------------------- 70 | proc macdnd::HandleEnter { path drag_source typelist } { 71 | variable _pressedkeys 72 | variable _actionlist 73 | set _pressedkeys 1 74 | set _actionlist { copy move link ask private } 75 | ::tkdnd::generic::HandleEnter $path $drag_source $typelist $typelist \ 76 | $_actionlist $_pressedkeys 77 | };# macdnd::HandleEnter 78 | 79 | # ---------------------------------------------------------------------------- 80 | # Command macdnd::HandlePosition 81 | # ---------------------------------------------------------------------------- 82 | proc macdnd::HandlePosition { drop_target rootX rootY {drag_source {}} } { 83 | variable _pressedkeys 84 | variable _last_mouse_root_x; set _last_mouse_root_x $rootX 85 | variable _last_mouse_root_y; set _last_mouse_root_y $rootY 86 | ::tkdnd::generic::HandlePosition $drop_target $drag_source \ 87 | $_pressedkeys $rootX $rootY 88 | };# macdnd::HandlePosition 89 | 90 | # ---------------------------------------------------------------------------- 91 | # Command macdnd::HandleLeave 92 | # ---------------------------------------------------------------------------- 93 | proc macdnd::HandleLeave { args } { 94 | ::tkdnd::generic::HandleLeave 95 | };# macdnd::HandleLeave 96 | 97 | # ---------------------------------------------------------------------------- 98 | # Command macdnd::HandleDrop 99 | # ---------------------------------------------------------------------------- 100 | proc macdnd::HandleDrop { drop_target data args } { 101 | variable _pressedkeys 102 | variable _last_mouse_root_x 103 | variable _last_mouse_root_y 104 | ## Get the dropped data... 105 | ::tkdnd::generic::SetDroppedData $data 106 | ::tkdnd::generic::HandleDrop {} {} $_pressedkeys \ 107 | $_last_mouse_root_x $_last_mouse_root_y 0 108 | };# macdnd::HandleDrop 109 | 110 | # ---------------------------------------------------------------------------- 111 | # Command macdnd::GetDragSourceCommonTypes 112 | # ---------------------------------------------------------------------------- 113 | proc macdnd::GetDragSourceCommonTypes { } { 114 | ::tkdnd::generic::GetDragSourceCommonTypes 115 | };# macdnd::GetDragSourceCommonTypes 116 | 117 | # ---------------------------------------------------------------------------- 118 | # Command macdnd::platform_specific_types 119 | # ---------------------------------------------------------------------------- 120 | proc macdnd::platform_specific_types { types } { 121 | ::tkdnd::generic::platform_specific_types $types 122 | }; # macdnd::platform_specific_types 123 | 124 | # ---------------------------------------------------------------------------- 125 | # Command macdnd::platform_specific_type 126 | # ---------------------------------------------------------------------------- 127 | proc macdnd::platform_specific_type { type } { 128 | ::tkdnd::generic::platform_specific_type $type 129 | }; # macdnd::platform_specific_type 130 | 131 | # ---------------------------------------------------------------------------- 132 | # Command tkdnd::platform_independent_types 133 | # ---------------------------------------------------------------------------- 134 | proc ::tkdnd::platform_independent_types { types } { 135 | ::tkdnd::generic::platform_independent_types $types 136 | }; # tkdnd::platform_independent_types 137 | 138 | # ---------------------------------------------------------------------------- 139 | # Command macdnd::platform_independent_type 140 | # ---------------------------------------------------------------------------- 141 | proc macdnd::platform_independent_type { type } { 142 | ::tkdnd::generic::platform_independent_type $type 143 | }; # macdnd::platform_independent_type 144 | -------------------------------------------------------------------------------- /tk/tkdnd2.7/x86/tkdnd_windows.tcl: -------------------------------------------------------------------------------- 1 | # 2 | # tkdnd_windows.tcl -- 3 | # 4 | # This file implements some utility procedures that are used by the TkDND 5 | # package. 6 | # 7 | # This software is copyrighted by: 8 | # George Petasis, National Centre for Scientific Research "Demokritos", 9 | # Aghia Paraskevi, Athens, Greece. 10 | # e-mail: petasis@iit.demokritos.gr 11 | # 12 | # The following terms apply to all files associated 13 | # with the software unless explicitly disclaimed in individual files. 14 | # 15 | # The authors hereby grant permission to use, copy, modify, distribute, 16 | # and license this software and its documentation for any purpose, provided 17 | # that existing copyright notices are retained in all copies and that this 18 | # notice is included verbatim in any distributions. No written agreement, 19 | # license, or royalty fee is required for any of the authorized uses. 20 | # Modifications to this software may be copyrighted by their authors 21 | # and need not follow the licensing terms described here, provided that 22 | # the new terms are clearly indicated on the first page of each file where 23 | # they apply. 24 | # 25 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 26 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 27 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 28 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | # 31 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 32 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 33 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 34 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 35 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 36 | # MODIFICATIONS. 37 | # 38 | 39 | namespace eval olednd { 40 | 41 | proc initialise { } { 42 | ## Mapping from platform types to TkDND types... 43 | ::tkdnd::generic::initialise_platform_to_tkdnd_types [list \ 44 | CF_UNICODETEXT DND_Text \ 45 | CF_TEXT DND_Text \ 46 | CF_HDROP DND_Files \ 47 | FileGroupDescriptor DND_Files \ 48 | FileGroupDescriptorW DND_Files \ 49 | CF_HTML DND_HTML \ 50 | {HTML Format} DND_HTML \ 51 | CF_RTF DND_RTF \ 52 | CF_RTFTEXT DND_RTF \ 53 | {Rich Text Format} DND_RTF \ 54 | ] 55 | 56 | ## Mapping from TkDND types to platform types... 57 | ::tkdnd::generic::initialise_tkdnd_to_platform_types [list \ 58 | DND_Text {CF_UNICODETEXT CF_TEXT} \ 59 | DND_Files {CF_HDROP} \ 60 | DND_HTML {CF_HTML {HTML Format}} \ 61 | DND_RTF {CF_RTF CF_RTFTEXT {Rich Text Format}} \ 62 | ] 63 | };# initialise 64 | 65 | };# namespace olednd 66 | 67 | # ---------------------------------------------------------------------------- 68 | # Command olednd::HandleDragEnter 69 | # ---------------------------------------------------------------------------- 70 | proc olednd::HandleDragEnter { drop_target typelist actionlist pressedkeys 71 | rootX rootY codelist } { 72 | focus $drop_target 73 | ::tkdnd::generic::HandleEnter $drop_target 0 $typelist \ 74 | $codelist $actionlist $pressedkeys 75 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 76 | $pressedkeys $rootX $rootY] 77 | if {$::tkdnd::_auto_update} {update} 78 | return $action 79 | };# olednd::HandleDragEnter 80 | 81 | # ---------------------------------------------------------------------------- 82 | # Command olednd::HandleDragOver 83 | # ---------------------------------------------------------------------------- 84 | proc olednd::HandleDragOver { drop_target pressedkeys rootX rootY } { 85 | set action [::tkdnd::generic::HandlePosition $drop_target {} \ 86 | $pressedkeys $rootX $rootY] 87 | if {$::tkdnd::_auto_update} {update} 88 | return $action 89 | };# olednd::HandleDragOver 90 | 91 | # ---------------------------------------------------------------------------- 92 | # Command olednd::HandleDragLeave 93 | # ---------------------------------------------------------------------------- 94 | proc olednd::HandleDragLeave { drop_target } { 95 | ::tkdnd::generic::HandleLeave 96 | if {$::tkdnd::_auto_update} {update} 97 | };# olednd::HandleDragLeave 98 | 99 | # ---------------------------------------------------------------------------- 100 | # Command olednd::HandleXdndDrop 101 | # ---------------------------------------------------------------------------- 102 | proc olednd::HandleDrop { drop_target pressedkeys rootX rootY type data } { 103 | ::tkdnd::generic::SetDroppedData [normalise_data $type $data] 104 | set action [::tkdnd::generic::HandleDrop $drop_target {} \ 105 | $pressedkeys $rootX $rootY 0] 106 | if {$::tkdnd::_auto_update} {update} 107 | return $action 108 | };# olednd::HandleXdndDrop 109 | 110 | # ---------------------------------------------------------------------------- 111 | # Command olednd::GetDragSourceCommonTypes 112 | # ---------------------------------------------------------------------------- 113 | proc olednd::GetDragSourceCommonTypes { drop_target } { 114 | ::tkdnd::generic::GetDragSourceCommonTypes 115 | };# olednd::GetDragSourceCommonTypes 116 | 117 | # ---------------------------------------------------------------------------- 118 | # Command olednd::platform_specific_types 119 | # ---------------------------------------------------------------------------- 120 | proc olednd::platform_specific_types { types } { 121 | ::tkdnd::generic::platform_specific_types $types 122 | }; # olednd::platform_specific_types 123 | 124 | # ---------------------------------------------------------------------------- 125 | # Command olednd::platform_specific_type 126 | # ---------------------------------------------------------------------------- 127 | proc olednd::platform_specific_type { type } { 128 | ::tkdnd::generic::platform_specific_type $type 129 | }; # olednd::platform_specific_type 130 | 131 | # ---------------------------------------------------------------------------- 132 | # Command tkdnd::platform_independent_types 133 | # ---------------------------------------------------------------------------- 134 | proc ::tkdnd::platform_independent_types { types } { 135 | ::tkdnd::generic::platform_independent_types $types 136 | }; # tkdnd::platform_independent_types 137 | 138 | # ---------------------------------------------------------------------------- 139 | # Command olednd::platform_independent_type 140 | # ---------------------------------------------------------------------------- 141 | proc olednd::platform_independent_type { type } { 142 | ::tkdnd::generic::platform_independent_type $type 143 | }; # olednd::platform_independent_type 144 | 145 | # ---------------------------------------------------------------------------- 146 | # Command olednd::normalise_data 147 | # ---------------------------------------------------------------------------- 148 | proc olednd::normalise_data { type data } { 149 | switch [lindex [::tkdnd::generic::platform_independent_type $type] 0] { 150 | DND_Text {return $data} 151 | DND_Files {return $data} 152 | DND_HTML {return [encoding convertfrom utf-8 $data]} 153 | default {return $data} 154 | } 155 | }; # olednd::normalise_data 156 | --------------------------------------------------------------------------------