Project64 Debugger
#1
Project64 debugger

Manual: https://hack64.net/docs/pj64d/
Javascript API documentation: https://hack64.net/docs/pj64d/apidoc.php
Project64 repo: https://github.com/project64/project64
Download development builds: https://www.pj64-emu.com/nightly-builds

Video demos
Javascript CPU event hooking example
Javascript socket example
Debugging example

If you have any bug reports, questions or suggestions, feel free to post them!

Old thread archive

[Image: KJhd94F.png]
Reply
#2
Changes since the last post in the old Origami64 thread:

Javascript API:
    Add events.onopcode
    Add events.ongprvalue
    Add file system interface (fs)
    Make AddressRange inclusive (fix ADDR_ANY)

Commands window:
    Support more commands in code editor
    Add "Step over" button
    Improve GPR read/write highlighting
    Fix crash from viewing unmapped memory

Memory viewer:
    Add memory locks feature (interpreter mode only)
    Make auto-refresh optional
    Fix crash from viewing unmapped memory (can now view memory-mapped registers)

Stack viewer:
    Fix crash from viewing unmapped memory

I also went ahead and fixed PJ64's settings window for Wine, so Linux users shouldn't need to manually edit the config file anymore.

The development build section on PJ64's website was made public (https://www.pj64-emu.com/nightly-builds), so I'm no longer uploading github releases to my personal fork.
Reply
#3
Added this CPU logging tool last night:



When "Enable CPU Logging" is checked, the PC, opcode, and GP/FP register states are pushed to a list at the start of every CPU step. Setting "Buffer size" sets the maximum number of states it's allowed to log before it starts tossing out old states. Double-clicking an entry in the list brings up the PC address in the command viewer.

I also made it so that when there is a CPU-related error, instead of just showing a nondescript error message and quitting, PJ64 will now pause and show the commands window at the exception vector, so the COP0 registers can be checked for the cause of the error.
Reply
#4
Added a window that lets you pick which exception codes the debugger should break on:



For most games you can check everything except interrupt and coprocessor unusable (and watchpoint? may be a bug). Some games which use TLB exceptions to their advantage may need the TLB-related codes unchecked.
Reply
#5
I upgraded the memory search tool to look and feel like Cheat Engine:

[Image: 68747470733a2f2f696d6167652e70726e747363...672e706e67]

Added features include:
  • A watchlist
  • Faster scanning with no result limit
  • Floating point support
  • A scan option for strings of unknown 1-byte encoding
  • Simple gameshark code creation

Watchlist data is saved/loaded automatically per game.
David, and sσnic × sρiraι liked this post
Reply
#6
Basic search tool tutorial:


sσnic × sρiraι liked this post
Reply
#7
The memory viewer has been upgraded to behave more like a proper hex editor. Most importantly that means you can copy and paste multiple bytes at a time and resize the window.

Manual: https://hack64.net/docs/pj64-memview-reference.htm



List of changes
David liked this post
Reply
#8
I loved the Javascript API <3
It would be very interesting to expand this API to run a native nodejs compatible with Node Modules.

Transform all this debug into a system of custom plugins built in NodeJS.
The plugins could be run in folders or zip files.

Is it possible to make the scripts work automatically with the emulator? That is another point that I would like to see.
I support Project 64 to be compatible with native NodeJS. I am interested in developing projects in the future using Project 64 Javascript API.

Last tiny question: Is it possible to use a method to obtain the game screen and the game audio? This would be useful for example for someone creating a web server that shows the game screen of the Project 64.

Another javascript suggestion.
You can control player 1, player 2, player 3, player 4 using scripts.
Reply
#9
I did a large update to the script API. New documentation here:
https://hack64.net/docs/pj64d/apidoc.php

Notable additions:

- expand events interface:
    - onstatechange
    - onpifread
    - onsptask
    - onpidma
    - onmousedown
    - onmouseup
    - onmousemove

-expand debug interface:
    - resume()
    - step()
    - skip()
    - showmemory(address[, physical])
    - showcommands(address)

- add console.listen(inputListener) for handling non-JS input from the script console
- add pj64 interface for high level control of the emulator (opening and closing roms, etc.)
- implement basic JS require() with native duktape module support
- add exec() function for shell command execution
- add remaining cop0 registers and fcr31
- add N64Image class for texture manipulation
- add local/remote address properties and more event listeners to Socket & Server

Breaking changes:

- change parameter(s) of events.on* callbacks to event objects
- rename fs.writeFile to fs.writefile
- rename fs.readFile to fs.readfile
- rename mem.float/mem.double to mem.f32/ mem.f64
- rename global float/double type IDs to f32/f64
- move gpr, ugpr, fpr, dfpr, cop0 interfaces into new cpu interface
- move gpr.pc to cpu.pc
- move gpr.hi/ugpr.hi to cpu.hi/cpu.uhi
- move gpr.lo/ugpr.lo to cpu.hi/cpu.ulo
- remove maskless variant of events.onopcode
- remove unstable screen interface and events.ondraw
- remove redundant rom interface because mem interface can access ROM
- remove GPR_ANY_ARG, GPR_ANY_TEMP, GPR_ANY_SAVE
- change parameter(s) of Server constructor
- change parameter(s) of socket.connect

---

There is also some work on a screen drawing interface similar to BizHawk's. It's a little unstable so I put it on a separate branch for now:

Source: https://github.com/shygoo/project64/tree...s-unstable
Documentation: https://hack64.net/docs/pj64d/apidoc-unstable.php
Download: https://hack64.net/docs/pj64d/Project64-....09.03.exe (the nag popup is removed).

If you're on Windows 7 you'll probably need to use a Direct3D plugin (i.e. Jabo's).
David liked this post
Reply




Users browsing this thread: 5 Guest(s)