Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 595
» Latest member: ReoNa
» Forum threads: 1,687
» Forum posts: 12,644

Full Statistics

Online Users
There are currently 80 online users.
» 2 Member(s) | 76 Guest(s)
Bing, Google, Zeraora

Latest Threads
Make it to 10,000
Forum: General Discussion
Last Post: Fifty
Today, 01:05 AM
» Replies: 6,282
» Views: 4,575,917
All Items Can Land v2 [Mr...
Forum: Online; Item
Last Post: Zeraora
07-15-2024, 07:20 PM
» Replies: 4
» Views: 10,088
Request: f_itembox never ...
Forum: Code Support / Help / Requests
Last Post: Unnamed
07-15-2024, 11:24 AM
» Replies: 7
» Views: 302
Item Box Respawn Timer Mo...
Forum: Offline; Item
Last Post: Unnamed
07-15-2024, 11:23 AM
» Replies: 0
» Views: 27
Force Character/Vehicle C...
Forum: Visual & Sound Effects
Last Post: _Ro
07-15-2024, 08:07 AM
» Replies: 0
» Views: 37
CPU bot (Online) [marito_...
Forum: Online Non-Item
Last Post: marito_yo
07-15-2024, 07:48 AM
» Replies: 2
» Views: 184
Ice Cube Always Visible i...
Forum: Visual & Sound Effects
Last Post: _Ro
07-15-2024, 07:43 AM
» Replies: 0
» Views: 23
Force Unused Error When S...
Forum: Incomplete & Outdated Codes
Last Post: _Ro
07-13-2024, 10:06 PM
» Replies: 5
» Views: 172
Item Cycler [Bully, Ro]
Forum: Online; Item
Last Post: annata20
07-13-2024, 03:38 AM
» Replies: 1
» Views: 521
Frame rate / game speed
Forum: Code Support / Help / Requests
Last Post: tofushoulder
07-12-2024, 02:13 AM
» Replies: 5
» Views: 678

 
  Request: Custom music volume reduction factor for Mushroom Gorge cave section
Posted by: lschlick - 04-15-2024, 06:13 PM - Forum: Code Support / Help / Requests - No Replies

In Mushroom Gorge, when you enter the cave, the volume of the music gets reduced. I would like a code which overrides the volume reduction factor. I assume it's fairly simple, you just need to locate the constant that determines the amount of volume reduction, and then replace it with a custom value.

There is a similar issue in N64 Sherbet Land. There are two different sound triggers that reduce the music volume by different amounts as you go deeper into the cave. A code for each of those would also be nice to have, though it's not as big a priority.

Print this item

  Mistake in the Broadway Manual regarding frsqrte
Posted by: Vega - 04-14-2024, 11:58 PM - Forum: Coding & Hacking General Discussion - No Replies

Most coders here are familiar with the Broadway Manual. If anybody has also read through it, you will find it littered with diagram mistakes and typoes. Considering it's a preliminary file that was never meant for the public, this is sort of expected.

However, I came across a decent mistake (or information left missing) regarding the description of the frsqrte instruction. I've been working on a Broadway PPC Instruction Simulator recently and have to make sure it's as accurate as possible. So I've been combing thru the manual at times.

According to the Broadway Manual (page 426), the frsqrte instruction does this~
1. frB used as input (64-bit input)
2. Reciprocal of Square Root Estimate is performed (within 1/4096 accuracy)
3. frD gets result as 64-bit

What's odd is that there is no mention about how the instruction operates in regards to the HID2 PSE bit. I've tried reading other Chapters, and there's nothing explicit. As an fyi, for every single-float instruction (except for fabs, fneg, and fnabs), the operation of said instruction varies depending on whether PSE bit is low or high.

For example, the fmr instruction.
When HID2 PSE is low
1. Entire Value of frB is copied to frD
When HID2 PSE is high
2. ps0 of frB copied to ps0 of frD. ps1 of frD is left UNCHANGED.

Another example (fdivs)
When HID2 PSE is low
1. Entire value of frA is divided by entire value of frB
2. Result placed in frB as 64-bit form but with single precision ofc
When HID2 PSE is high
1. ps0 of frA is divided by ps0 of frB
2. result placed into BOTH ps0 and ps1 of frD

Basically in all the single-float math-type instructions, when HID2 PSE is high, ps0 is input and ps0 + ps1 is output. As you can see above, the fmr instruction is an old ball with frD ps1 being unchanged. The frsp instruction is another odd ball to where the frD's ps1 is left undefined (junk).

The Broadway Manual has zero information about what occurs for frsqrte in regards to HID2 PSE. Nothing. So anyway I did some tests on Real Hardware and this is what occurs~

When HID2 PSE is low
1. Entire 64-bit frB used for input
2. frD gets result as 64-bits

When HID2 PSE is high
1. ps0 of frB is used for input
2. ps0 of frD gets result. ps1 of frD is left UNCHANGED


If anyone cares this is the following code I used for confirmation. f1 gets loaded as 4.0, 0.0. f2 gets loaded as 1.25, 1.25. I then perform a frsqrte (with HID2 PSE high) where f1 is frB and f2 is frD.

f2 resulted as 0x3EFFF400 3FA00000 (~0.499, 1.25). ps0 of f2 didn't result exactly as 0.5, this is expected due to the 1/4096 accuracy effect.

In conclusion this information is missing from the 1.0 version of the Broadway Manual which is the latest version afaik.

Code:
#C2 Address 807BA164
#Pick up box, see result on screen

.set HID2, 920
.set PSE, 0x2000

#Check PSE bit of HID2
mfspr r3, HID2
andis. r0, r3, PSE
bne+ good_to_go

#Set r5 arg for OSFatal
bl setbadfatal
.asciz "NOTE! PSE of HID2 is low. Try again or try a diff hook address."
setbadfatal:
mflr r5
b goodfatal

#Set our single float constant value (4)
good_to_go:
lis r3, 0x4080
ori r3, r3, 0x0000
li r4, 0
lis r5, 0x3FA0

#Place value into ps0 of f1 with ps1 being null
lis r31, 0x8000
ori r31, r31, 0x1500
stw r3, 0 (r31)
stw r4, 4 (r31)
stw r5, 8 (r31)
stw r5, 0xC (r31)
psq_l f1, 0 (r31), 0, 0
psq_l f2, 0x8 (r31), 0, 0

#Do square root on it
frsqrte f2, f1

#Store results
psq_st f2, 0x0 (r31), 0, 0

#Load the fpr into GPRs r5 and r6 for sprintf
lwz r5, 0 (r31)
lwz r6, 4 (r31)

#Set r4 arg for sprintf
bl setsprintf
.asciz "%08X %08X"
.align 2
setsprintf:
mflr r4

#Set r3 arg for sprintf
addi r3, r31, 0x40

#Clear cr1 eq bit cuz no floats for sprintf
crclr 6

#Call sprintf
lis r12, 0x8001
ori r12, r12, 0x1A2C
mtctr r12
bctrl

addi r5, r31, 0x40

#Setup OSFatal args
goodfatal:
bl setupfatal
.long 0xFFFFFFFF
.long 0
setupfatal:
mflr r3
addi r4, r3, 4

#Call OSFatal
lis r12, 0x801A
ori r12, r12, 0x4EC4
mtctr r12
bctr

Print this item

  Request: Additional sound trigger for Mushroom Gorge
Posted by: lschlick - 04-14-2024, 01:01 AM - Forum: Code Support / Help / Requests - Replies (7)

KCL flags of a given type can have up to 8 variants. In Mushroom Gorge, the KCL flag of type sound trigger has 4 defined variants, with the other 4 being having undefined behavior. The first defined variant enables annoying wind ambience. The other 3 defined variants enable cave ambience and reduce the music volume.

There are plenty of custom tracks that use Mushroom Gorge's property slot in which wind ambience does fit. Specifically those which are set in the skies or up on tall mountains. However, there are some custom tracks in which wind ambience does not fit. One such example is Mushoom Hideaway, which is set in more of a forested setting and not in the skies or up on tall mountains. For a track such as Mushroom Hideaway, there is no way to get the ambience sounding right for the given setting.

I could edit the brsar to set wind ambience volume to zero, but the problem is that it applies to every track, even the ones with a high-altitude setting in which wind ambience fits very well.

Most track slots have a sound trigger that allows you to disable all ambiences. But Mushroom Gorge has no such thing, yet it is in need of it. I am requesting a code that would interpret one of the unused sound trigger variants in Mushroom Gorge as a sound trigger that disables both wind ambience and cave ambience. Is this something that is hypothetically possible to make?

Print this item

  Fixing Blackscreen Everywhere on Debian 12 using NVidia 3080 12gb
Posted by: Vega - 04-09-2024, 03:18 PM - Forum: General Discussion - No Replies

I've bought a new setup (computer, monitor, etc) from my brother yesterday. A huge upgrade from my 7 year old Desktop, lmao.

Tried installing Debian 12. Install went great, but I was getting Blackscreen everywhere immediately after the GRUB bootloader echoed some basic outputs (right before the graphics are initiated).

So as a personal note for future reference and the off chance somebody needs this.. here's how to fix it!

The issue:
Blackscreen or Very Dark Gray Screen (may flicker) after GRUB screen. Using CTRL+ALT+F2 (to switch to TTY mode) does *NOT* work (still Blackscreens)

The solution:
1. Power off. Then power on.
2. Once GRUB loads, press down on keyboard to stop it from auto-booting
3. Navigate down on keyboard to pre-select  "Advanced Options for..."  Do *NOT* press Enter. Just be hovered over it
4. Press e on your keyboard to bring up GRUB's built in editor for the Advanced Options
5. The config file to how Grub will boot Debian will be shown
6. Using the arrow keys, navigate until you see the following...
quiet
7. Change that text to now be this...
quiet nomodeset
8. Now press F10 to save and exit. This will apply the new config file for the next boot *ONLY*.
9. You should be at a screen where you can select to boot regular Debian 12 or Debian 12 in recovery mode.
10. Choose regular Debian 12
11. Debian 12 will boot but using BIOS graphics.
12. Log in as root and open a terminal, run the following commands
apt update
apt upgrade
apt install nvidia-detect
13. Once nvidia-detect has been installed, run it...
nvidia-detect
14. The program will output a list of package(s), that you will need to install. For me it was just nvidia-drivers. You may have more or different packages
15. Install all the packages that were listed!!!
16. Once all packages are installed, reboot your computer.
17. GRUB will be back to using the original/default config file and you should now see that the graphics are fixed once Debian 12 boots.

Print this item

  Maximum Player Collision
Posted by: MarioKartUltimate - 04-06-2024, 11:09 PM - Forum: Code Support / Help / Requests - No Replies

Is there a code that provides Max Collision. I mean a code where if you bump into someone, they are send flying off instantly.

Print this item

  Load State at Breakpoint (specific game event)
Posted by: seanmcnally - 03-25-2024, 01:08 AM - Forum: Coding & Hacking General Discussion - Replies (1)

This is the story of a cheat code I wanted to make, was unable to make, and the hack-y solution I came up with to get around it.

In 4P mode, I was looking for a way to jump back to the character selection screen after each race, that way in a tournament setting where the players change each race, you wouldn't need to quit to the main menu each time.  As you probably know, normal behavior is that after each race, you press "next race", and it goes to the cup selection screen assuming you want to play again with the same character/vehicle selections.

I started out by trying to figure out the instruction where that menu - the cup selection screen - is loaded after you press next race.  Using this list, I was able to find that the cup selection menu is referred to as 6E, so I went to work with some excruciating dynamic analysis, going frame by frame until I found something that was writing 6E.  Good news, I did!  8070ca50 contains stw r30, 0x0004 (r29), and r30 contains 6E after you press next race.  Furthermore, r9 = 17 when you're accessing the cup selection screen from a new match, and r9 = 5 when you're accessing it from the "Next Race" button.  So you'd think I could just write a code to use load instruction on r30 before that 6E is written, and put something like 6B (Character Select) instead, but that didn't work.  The byte gets written successfully, but the game still goes into the cup selection screen.

It was at this point that I realized, maybe I can do this without affecting game logic at all.  I'm going to be using Dolphin for the tournament anyway, so what if, instead of a cheat code, I just loaded a state when that 8070ca50, r9 == 5 breakpoint hit?  I could just use Python to watch dolphin.log, and send a hotkey to load a state that jumps to the character select screen.

So....



Here's a very silly solution to my problem:

This is adapted from my Logging Game Events to Text File post.

1) In Dolphin, go to  Options > Configuration > Interface > Enable Debugging UI.

Go to View, make sure Breakpoints, Log, and Log Configuration are checked. Then, in the Log Configuration tab, uncheck everything except "Master Log (MASTER)" and "Memory Interface & Memory Map (MI)".  At this point you should probably find Dolphin's log file (dolphin.log) and delete it, that way you're starting fresh (on Windows it is found at C:\Users\YourUserName\AppData\Roaming\Dolphin Emulator\Logs).

2) Add 8070ca50 as a breakpoint for NTSC-U.  In the condition box, write r9 == 5.

These are the breakpoints for other versions (untested)
  • NTSC-U  8070ca50
  • PAL 0x807144f4
  • NTSC-J 0x80713b60
  • NTSC-K 0x8070289c

3) Save a state.  In my example, I'm using State Slot 1, default hotkey is Shift+F1 to save, F1 to load.

4) Run this Python script.  You'll need to install the keyboard module (run cmd as admin, pip install keyboard):

load-state-after-bp.py
Code:
import time
import os
import keyboard

class LogFileWatcher:
    def __init__(self, log_file):
        self.log_file = log_file
        self.last_position = 0
        self.current_data = ""
        print("Watching log file:", log_file)

    def watch(self):
        try:
            while True:
                self.dump_changes()
                time.sleep(0.05)
        except KeyboardInterrupt:
            print("Watcher stopped.")

    def dump_changes(self):
        try:
            with open(self.log_file, 'r') as f:
                f.seek(self.last_position)
                new_data = f.read()
                if new_data:
                    if new_data.startswith('\r\n'):
                        new_data = new_data[2:]  # Remove the first two characters (CR LF)
                    elif new_data.startswith('\n'):
                        new_data = new_data[1:]  # Remove the first character (LF)
                    self.current_data = new_data
                    print("Changes detected:")
                    print(self.current_data)
                    if "1. Vars:  r9=5" in new_data:
                        print("True")
                        keyboard.press('f1')  # Press F1 key
                        time.sleep(0.1)  # Hold F1 for 100 milliseconds
                        keyboard.release('f1')  # Release F1 key
                    self.last_position = f.tell()
        except Exception as e:
            print("Error occurred:", str(e))

if __name__ == "__main__":
    log_file = "C:\\Users\\Sean\\AppData\\Roaming\\Dolphin Emulator\\Logs\\dolphin.log"
   
    watcher = LogFileWatcher(log_file)
    watcher.watch()


5) Be sure to edit the log_file variable near the bottom to use your computer's username instead of mine.

And that's it.  Again, not ideal, but it does work.  I'm also aware there's a Dolphin module for Python that avoids needing to use keypresses and can just load the state directly, feel free to have a go at that if you want.

Print this item

  Game Resets after "Next Race" [SeanMcNally]
Posted by: seanmcnally - 03-23-2024, 04:04 AM - Forum: Incomplete & Outdated Codes - Replies (2)

Not even sure if I can call myself the creator of this one, since it basically just rips the activator out of Diamond's Press Button to Reset to Title Screen and puts it at an insertion address that I found.  The cup selection screen can be accessed from a bunch of different ways.  If r9 = 5, that means the cup selection screen was accessed from pressing "Next Race" after a race.  If r9 = 17, the cup selection screen was accessed from the starting a new grand prix or versus race and selecting your character, vehicle, and drift options.  This code checks for the first scenario.  Not ported, but here it is, for NTSC-U Only:

C270CA50 00000006
93DD0004 2C090005
41820008 48000020
3D80809B 618CD508
806C0000 3D808060
618C4CD8 7D8803A6
4E800021 00000000

Source Code:

Code:
# Insertion Address: 8070ca50 for NTSC-U
#
stw r30, 0x0004 (r29) # Default instruction
cmpwi r9, 5          # If r9 = 5, this instruction is running after pressing "next race"
# Worth noting that if r9 = 17, this instruction is running after the character select screen
beq game_reset # If five, reset the game
b end_code # If not, end the code
# This part resets the game, Diamond wrote this code
game_reset:
lis r12, 0x809B
ori r12, r12, 0xD508
lwz r3, 0(r12)
lis r12, 0x8060
ori r12, r12, 0x4CD8
mtlr r12
blrl
end_code:

Credits: Diamond, for creating the part that resets the game.

Print this item

  Artemis (PPC Instruction Simulator)
Posted by: Vega - 03-20-2024, 02:27 AM - Forum: Coding & Hacking General Discussion - Replies (2)

Artemis




Created by Vega

Version: 0.0-r059



What is Artemis?
Artemis is a bare-bones PowerPC 32-bit Instruction Simulator written in ARM64 Assembly.

Why the name Artemis?
Artemis is one of Daysha's cats. He is Waltress's brother.

Why write this in ARM64 Assembly?
Needed a project in ARM64 to work on after learning the language.

What can Artemis do right now?
Source does compile but it will most likely fault since current revision is untested. At the moment, Artemis can execute basic instructions in physical memory. IBAT translation works in theory. DBAT translation and Page Tables are not implemented yet. Cache is sort of implemented but won't work since MEI protocol isn't built yet. Effects from most items such as HIDx SPR settings are not working yet. Anything FPSCR related won't work either.

What do I need to run Artemis?
QEMU installed on a Linux Machine. Read the README.md for the rest.

What are the goals of Artemis?
The goal is to accurately simulate every Broadway instruction and register. Please note that this is *not* meant to replace Dolphin or even emulate a Wii.

Print this item

  Finding breakpoint for "Course Overview" cutscene
Posted by: seanmcnally - 03-17-2024, 12:09 AM - Forum: Coding & Hacking General Discussion - Replies (5)

Trying to find a good insertion point for an event that doesn't really have any numbers associated with it, and isn't really triggered by anything other than normal game function - the opening "course overview" cutscene that plays at the beginning of each race.  The eventual idea is that I want to prevent the player from being able to skip this cutscene.  I'm guessing I can either nop out the function that skips it, or maybe find a way of preventing input while the scene is active.

The trouble is I'm unsure how to find the insertion point for something like this.  It's not an item, it doesn't really have to do with regular gameplay.  I tried putting a breakpoint on my controller to see if I could maybe figure out how the instruction is being executed when you skip the cutscene, but nothing I tried seemed to provide anything that made sense.  How would I go about finding the right insertion point?

Any tips greatly appreciated, thank you!

Print this item

  Condition box on Dolphin’s Breakpoint menu?
Posted by: seanmcnally - 03-16-2024, 02:59 AM - Forum: Coding & Hacking General Discussion - Replies (6)

Apologies if this has already been answered elsewhere, but I haven’t been able to find any documentation on this. What exactly does the “condition” box do inside Dolphin’s breakpoint menu?[Image: 38df161860813b8846201.jpg]

Print this item