Skip to content

Instantly share code, notes, and snippets.

View bigfarts's full-sized avatar
💨
toot

bigfarts

💨
toot
View GitHub Profile
import struct
firmware = bytearray(b'\xff' * 0x20000)
userdata = 0x7fe00 & 0x1ffff
firmware[userdata:userdata+0x74] = b'\x00' * 0x74
firmware[0x20:0x20+2] = struct.pack('<H', (0x20000 - 0x200) >> 3)
firmware[userdata] = 5
#!/usr/bin/env python3
# (license terms due to pymusiclooper)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
CXX = g++
CXXFLAGS = $(shell pkg-config --cflags ncurses sndfile portaudio-2.0 jsoncpp) -I/opt/homebrew/include -Wall -Wextra -Wconversion -Wunreachable-code -std=c++17 -O3 -g
LDFLAGS = $(shell pkg-config --libs ncurses sndfile portaudio-2.0 jsoncpp) -I/opt/homebrew/lib
BINARY = agbdump
SRC_FILES := $(wildcard agbplay/src/*.cpp)
SRC_FILES := $(filter-out agbplay/src/agbplay.cpp, $(SRC_FILES))
OBJ_FILES = $(addprefix agbplay/obj/,$(notdir $(SRC_FILES:.cpp=.o)))
band = bit.band
function flaginfo_to_string(tbl)
local result = ""
for k, v in pairs(tbl) do
if v then
result = result .. '\n' .. k
end
end
return result:sub(2)
# THIS IS PSEUDOCODE
# THIS IS PSEUDOCODE
# THIS IS PSEUDOCODE
# This is the logic exactly as written in BN6. It's kind of weird!
def processflashing(obj):
if obj.flashingtimeleft == 0 and obj.hit.flash:
obj.flashingtimeleft = 120
obj.hit.flash = False

Pipsqueak

THIS IS A DRAFT IN REVIEW. DO NOT IMPLEMENT THIS!

  • Version: 0 (DRAFT!)

Pipsqueak is a position-independent patch format. It is designed such that simple ROM formats such as GBA can have multiple patches applied together composably by attaching semantic information to content in the patch such that addresses may be relocated, if required.

Goals:

  • A patch format that supports relocations.

ROM overview

This is intended to be a quick and dirty overview about how stuff is laid out in memory in BN.

GBA memory map

All I/O on the GBA is done via a big-ass memory map that goes from address 0x00000000 to 0x0fffffff (roughly). For our intents and purposes, we only really need to care about two regions:

  • [0x02000000, 0x04000000): WRAM: This is where the working memory of the GBA is resident. In BN, starting at 0x02000000, this is actually a copy of the save data (SRAM) after it has been decoded.
  • This is further split into EWRAM at [0x02000000, 0x03000000) and IWRAM at [0x03000000, 0x04000000), but we don't have to care too much about this.
use std::borrow::Cow;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::Window,
};
async fn run(event_loop: EventLoop<()>, window: Window) {
let size = window.inner_size();
let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY);
diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs
index bf11afe8..f2e29b55 100644
--- a/wgpu-hal/src/gles/egl.rs
+++ b/wgpu-hal/src/gles/egl.rs
@@ -854,7 +854,9 @@ impl crate::Instance<super::Api> for Instance {
config: inner.config,
presentable: inner.supports_native_window,
raw_window_handle,
+ present_program: None,
swapchain: None,
; license: be gay do crime
.gba
.open "bn1.gba", 0x08000000
.org 0x080566e8
bl conditional_flashing
.org 0x080566ec
bl conditional_flinching