This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# this script generates C headers from df-structures codegen.out.xml | |
# input is 1st argument or 'codegen/codegen.out.xml' | |
# default is generating IDA-compatible headers | |
# to generate full C headers, use | |
# perl codegen --stdc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef void* (*MALLOC)(size_t); | |
MALLOC old_malloc; | |
typedef void (*FREE)(intptr_t); | |
FREE old_free; | |
void* new_malloc(size_t s) | |
{ | |
void *addr = old_malloc(s+32); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find_race(name) | |
name = name:lower() | |
for i,v in ipairs(df.global.world.raws.creatures.all) do | |
if v.creature_id:lower() == name:lower() then | |
return i | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local gui = require 'gui' | |
local dialog = require 'gui.dialogs' | |
local widgets = require 'gui.widgets' | |
local guiScript = require 'gui.script' | |
local utils = require 'utils' | |
function show_description(type, id) | |
local unit = df.unit:new() | |
local scr = df.viewscreen_unitlistst:new() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local biome_region_offsets = { {-1,-1}, {0,-1}, {1,-1}, {-1,0}, {0,0}, {1,0}, {-1,1}, {0,1}, {1,1} } | |
local biome_offset_idx = block.region_offset[block.designation[x%16][y%16].biome] | |
local geolayer_idx = block.designation[x%16][y%16].geolayer_index | |
local offset = biome_region_offsets[biome_offset_idx+1] | |
local rpos = { bit32.rshift(df.global.world.map.region_x,4) + offset[1], bit32.rshift(df.global.world.map.region_y,4) + offset[2] } | |
local rbio = dfhack.maps.getRegionBiome(table.unpack(rpos)) | |
local geobiome = df.world_geo_biome.find(rbio.geo_index) | |
local layer = geobiome.layers[geolayer_idx] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ms = require 'memscan' | |
cdata = ms.get_cdata_segment() | |
data = ms.get_data_segment() | |
function reverseAndReadString(buf, idx) | |
local s = '' | |
local min = idx - 200 | |
while idx > min do | |
local c = buf[idx] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0'?> | |
<data-definition> | |
<symbol-table name='0.43.04' os-type='darwin'> | |
<md5-hash value='319ec9286b56bbcf45348c2356a37bd3'/> | |
.data | |
<global-address name='cursor'/> | |
<global-address name='selection_rect'/> | |
<global-address name='gamemode'/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require, exports, module) { | |
"use strict"; | |
var oop = require("../lib/oop"); | |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
var DFHighlightRules = function() { | |
this.$rules = { | |
"start": [ |