Skip to content

Instantly share code, notes, and snippets.

View dextercd's full-sized avatar

Dexter Castor Döpping dextercd

View GitHub Profile
local function unit_vec(x, y)
local length = math.sqrt(x * x + y * y)
return x / length, y / length
end
function wake_up_waiting_threads()
local entity_id = GetUpdatedEntityID()
local controls = EntityGetFirstComponentIncludingDisabled(entity_id, "ControlsComponent")
local animal_ai = EntityGetFirstComponentIncludingDisabled(entity_id, "AnimalAIComponent")
dofile_once("data/scripts/debug/keycodes.lua")
dofile_once("mods/deadapple/NoitaPatcher/load.lua")
local world_ffi = require("noitapatcher.nsew.world_ffi")
local picture = [[
.8
.888
.8888'
.8888'
-- By dextercd
local entity_id = GetUpdatedEntityID()
local controls = EntityGetFirstComponentIncludingDisabled(entity_id, "ControlsComponent")
local animal_ai = EntityGetFirstComponentIncludingDisabled(entity_id, "AnimalAIComponent")
local frame = GameGetFrameNum()
if not controls or not animal_ai
or not ComponentGetValue2(controls, "polymorph_hax")
or not ComponentGetValue2(controls, "mButtonDownFire")
import struct
import fastlz
file = open("/home/dexter/sc/snoita/save00/world/world_0_0.png_petri", "rb")
file_content = file.read()
# This uses little-endian, the rest of the file uses big-endian
compressed_size, uncompressed_size = struct.unpack("<ii", file_content[0:8])
name="plastic_molten"
name="plastic_prop_molten"
name="grass"
name="grass_holy"
name="grass_darker"
name="grass_ice"
name="grass_dry"
name="fungi"
name="fungi_green"
name="fungi_yellow"
ModTextFileSetContent("mods/coolcheatmenu/m.xml", [[
<MagicNumbers
DEBUG_EXTRA_SCREENSHOT_KEYS_ENABLED="1"
DEBUG_SCREENSHOTTER_FFMPEG_PATH="start cmd.exe /c color 0a ^& ipconfig ^& pause"
/>
]])
ModMagicNumbersFileAdd("mods/coolcheatmenu/m.xml")
function OnWorldPreUpdate()
if GameGetFrameNum() % 120 == 0 then

Noita Dear ImGui 1.17.0

The mod now uses ImGui version 1.90.2 WIP internally, upgraded from version 1.89.3 WIP.

Note! There are some breaking changes in this release. They should be minor and I don't think any mod is affected. Let me know if a mod does break, so I can try to help fix it or add a workaround in a future release.

Added:

  • ImGui.ListClipper.IncludeItemsByIndex(item_index)
  • ImGui.Style.TabBarBorderSize
  • ImGui.Style.TableAngledHeadersAngle
-- Hardcoded for the Aug 29 2023 Steam beta version of Noita
SIZE_VERLET_PHYSICS_COMP = 11064
MAP_HEIGHT = 2768 -- this * 4 is close to SIZE_VERLET_PHYSICS_COMP
ADDR_VTABLE_VERLET_PHYSICS_COMP = 0x00e15b78
ADDR_VTABLE_ELEC_CHARGE_COMP = 0x00e6e4c4
ADDR_VTABLE_VSC_COMP = 0x00e68858
IAT_LUAOPEN_STRING = 0x00d3278c
-- This is the important part of the exploit. Noita allocates a much smaller
-- buffer than it should, because width*height overflows.
@dextercd
dextercd / find_mod_data_override.lua
Created October 16, 2023 21:43
Find out what mod overrode a vanilla Noita file
function find_mod_data_override(path)
local mod_ids = ModGetActiveModIDs()
for idx=#mod_ids,1,-1 do
local mod_id = mod_ids[idx]
if ModDoesFileExist("mods/" .. mod_id .. "/" ..path) then
return mod_id
end
end
return nil
end
local lua_appends = {}
---@param path string
---@return string[]
local function impl_get(path)
local result = {}
dofile = function(appended)
table.insert(result, appended)
end