Skip to content

Instantly share code, notes, and snippets.

View TinkerWorX's full-sized avatar

Nikolaj Mariager TinkerWorX

  • Protominox
  • Denmark
View GitHub Profile
using MindWorX.FEZShared;
namespace MindWorX.FEZCobra.TX433
{
public class Program
{
private static OutputPort MainLED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);
private static InputPort DownButton = new InputPort((Cpu.Pin)FEZ_Pin.Digital.ButtonDown, true, Port.ResistorMode.PullUp);
using MindWorX.FEZShared;
namespace MindWorX.FEZCobra.TX433
{
public class Program
{
private static OutputPort MainLED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);
private static InputPort DownButton = new InputPort((Cpu.Pin)FEZ_Pin.Digital.ButtonDown, true, Port.ResistorMode.PullUp);
class CombatSimulator
{
public List<String> CombatLog = new List<String>() { "No combat has happened yet." };
public void ResolveCombat(Party attacking, Party defending)
{
this.CombatLog = new List<String>();
var attackers = new List<Unit>(attacking.Units);
var defenders = new List<Unit>(defending.Units);
if (IsWindows)
{
if (IsChrome)
{
//active.push(['XInput ', 'GAMEPAD', ChromeWindowsXinputGamepad, "Xbox 360", Gamepad_ImageDataUrls_Xbox360]);
}
else if (IsFirefox)
{
if (gamepadState.Name.Contains("45e-")) // Microsoft
{
<!-- The instructions here are all for IDAPro versions 5.5 or 6.1 -->
<!-- The version should be set to the version of the game the addresses works with -->
<sharpcraft version="1.26.0.6401" debug="true">
<!--
First thing you need is to get the image base, and
note it down. This can be found by scrolling to the
top in an IDA View tab, usually the fifth line
looking like this:
.text:6F001000 ; Imagebase : 6F000000
[JassType("Hplayer;")]
private struct JassPlayer
{
// constant native GetLocalPlayer takes nothing returns player
private delegate JassPlayer GetLocalPlayerPrototype();
private static GetLocalPlayerPrototype GetLocalPlayer;
// constant native Player takes integer number returns player
private delegate JassPlayer PlayerPrototype(JassInteger number);
private static PlayerPrototype Player;
...
21:21:12: sub_6F4C1AB0(..., .?AVCTriggerExecution@@, ...) = 0x11203774
21:21:12: sub_6F4C1AB0(..., .?AUScriptData@@, ...) = 0x137A8EE4
21:21:12: sub_6F4C1AB0(..., .?AUScriptData@@, ...) = 0x137A8F0C
Tick
21:21:12: sub_6F4C1AB0(..., .?AVCTriggerExecution@@, ...) = 0x11203774
21:21:12: sub_6F4C1AB0(..., .?AUScriptData@@, ...) = 0x137A8EE4
21:21:12: sub_6F4C1AB0(..., .?AUScriptData@@, ...) = 0x137A8F0C
Tick
21:21:12: sub_6F4C1AB0(..., .?AVCTriggerExecution@@, ...) = 0x11203774
...
private static int Sub_6F2FB480Hook(int _this, int a2, String a3, int a4, float a5)
{
var result = Sub_6F2FB480(_this, a2, a3, a4, a5);
// _this is an unknown pointer
// a2 is the zero-based player id
// a3 is the message
// a4 is the chat method (0;ALL, 1;ALLIES, 2;REFEREES/OBSERVERS, 3:PRIVATE)
// a5 duration in seconds
...
private static void Jass_PreConfig()
{
IntPtr handle = IntPtr.Zero;
if (SFileOpenFileEx(IntPtr.Zero, "war3map.cs", 0x00, ref handle))
{
Int32 size = SFileGetFileSize(handle);
var buffer = Marshal.AllocHGlobal(size);
SFileReadFile(handle, buffer, size);
var code = Marshal.PtrToStringAnsi(buffer);
00000000 CGameUI struc ; (sizeof=0x451)
00000000 vtable dd ?
00000004 db ? ; undefined
00000005 db ? ; undefined
00000006 db ? ; undefined
00000007 db ? ; undefined
00000008 db ? ; undefined
00000009 db ? ; undefined
0000000A db ? ; undefined
0000000B db ? ; undefined