diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..4a83177 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/sig/modules/RabiRace/SessionCreateWindow.java=UTF-8 +encoding//src/sig/modules/RabiRace/SessionListWindow.java=UTF-8 diff --git a/Boss Sprites/Cirno.png b/Boss Sprites/Cirno.png new file mode 100644 index 0000000..97bf78b Binary files /dev/null and b/Boss Sprites/Cirno.png differ diff --git a/Boss Sprites/DevilMachine.png b/Boss Sprites/DevilMachine.png new file mode 100644 index 0000000..8170984 Binary files /dev/null and b/Boss Sprites/DevilMachine.png differ diff --git a/Boss Sprites/ENEMYDiamondMasahirorin.png b/Boss Sprites/ENEMYDiamondMasahirorin.png new file mode 100644 index 0000000..7cae0b5 Binary files /dev/null and b/Boss Sprites/ENEMYDiamondMasahirorin.png differ diff --git a/Boss Sprites/Masked_Maid_Girl.png b/Boss Sprites/Masked_Maid_Girl.png new file mode 100644 index 0000000..c03156a Binary files /dev/null and b/Boss Sprites/Masked_Maid_Girl.png differ diff --git a/Boss Sprites/Starman_Junior.png b/Boss Sprites/Starman_Junior.png new file mode 100644 index 0000000..93e0aeb Binary files /dev/null and b/Boss Sprites/Starman_Junior.png differ diff --git a/Boss Sprites/TME_-100.png b/Boss Sprites/TME_-100.png new file mode 100644 index 0000000..217bf92 Binary files /dev/null and b/Boss Sprites/TME_-100.png differ diff --git a/Boss Sprites/TME_-10000.png b/Boss Sprites/TME_-10000.png new file mode 100644 index 0000000..d0d436a Binary files /dev/null and b/Boss Sprites/TME_-10000.png differ diff --git a/Boss Sprites/TME_-101.png b/Boss Sprites/TME_-101.png new file mode 100644 index 0000000..ae3aedf Binary files /dev/null and b/Boss Sprites/TME_-101.png differ diff --git a/Boss Sprites/TME_-84.png b/Boss Sprites/TME_-84.png new file mode 100644 index 0000000..b4775bf Binary files /dev/null and b/Boss Sprites/TME_-84.png differ diff --git a/Boss Sprites/TME_103.png b/Boss Sprites/TME_103.png new file mode 100644 index 0000000..a4a083e Binary files /dev/null and b/Boss Sprites/TME_103.png differ diff --git a/Boss Sprites/TME_104.png b/Boss Sprites/TME_104.png new file mode 100644 index 0000000..08cf020 Binary files /dev/null and b/Boss Sprites/TME_104.png differ diff --git a/Boss Sprites/TME_108.png b/Boss Sprites/TME_108.png new file mode 100644 index 0000000..4f08191 Binary files /dev/null and b/Boss Sprites/TME_108.png differ diff --git a/Boss Sprites/TME_120.png b/Boss Sprites/TME_120.png new file mode 100644 index 0000000..0b93519 Binary files /dev/null and b/Boss Sprites/TME_120.png differ diff --git a/Boss Sprites/TME_122.png b/Boss Sprites/TME_122.png new file mode 100644 index 0000000..b503b56 Binary files /dev/null and b/Boss Sprites/TME_122.png differ diff --git a/Boss Sprites/TME_136.png b/Boss Sprites/TME_136.png new file mode 100644 index 0000000..c091306 Binary files /dev/null and b/Boss Sprites/TME_136.png differ diff --git a/Boss Sprites/TME_137.png b/Boss Sprites/TME_137.png new file mode 100644 index 0000000..27604f1 Binary files /dev/null and b/Boss Sprites/TME_137.png differ diff --git a/Boss Sprites/TME_138.png b/Boss Sprites/TME_138.png new file mode 100644 index 0000000..db76fe0 Binary files /dev/null and b/Boss Sprites/TME_138.png differ diff --git a/Boss Sprites/TME_15.png b/Boss Sprites/TME_15.png new file mode 100644 index 0000000..661910b Binary files /dev/null and b/Boss Sprites/TME_15.png differ diff --git a/Boss Sprites/TME_200.png b/Boss Sprites/TME_200.png new file mode 100644 index 0000000..8c442c5 Binary files /dev/null and b/Boss Sprites/TME_200.png differ diff --git a/Boss Sprites/TME_202.png b/Boss Sprites/TME_202.png new file mode 100644 index 0000000..d49f091 Binary files /dev/null and b/Boss Sprites/TME_202.png differ diff --git a/Boss Sprites/TME_203.png b/Boss Sprites/TME_203.png new file mode 100644 index 0000000..88314cd Binary files /dev/null and b/Boss Sprites/TME_203.png differ diff --git a/Boss Sprites/TME_23.png b/Boss Sprites/TME_23.png new file mode 100644 index 0000000..e96e3cf Binary files /dev/null and b/Boss Sprites/TME_23.png differ diff --git a/Boss Sprites/TME_24.png b/Boss Sprites/TME_24.png new file mode 100644 index 0000000..c79ffb2 Binary files /dev/null and b/Boss Sprites/TME_24.png differ diff --git a/Boss Sprites/TME_33.png b/Boss Sprites/TME_33.png new file mode 100644 index 0000000..82369fb Binary files /dev/null and b/Boss Sprites/TME_33.png differ diff --git a/Boss Sprites/TME_38.png b/Boss Sprites/TME_38.png new file mode 100644 index 0000000..c449ec0 Binary files /dev/null and b/Boss Sprites/TME_38.png differ diff --git a/Boss Sprites/TME_43.png b/Boss Sprites/TME_43.png new file mode 100644 index 0000000..fb6de47 Binary files /dev/null and b/Boss Sprites/TME_43.png differ diff --git a/Boss Sprites/TME_44.png b/Boss Sprites/TME_44.png new file mode 100644 index 0000000..31dec3a Binary files /dev/null and b/Boss Sprites/TME_44.png differ diff --git a/Boss Sprites/TME_48.png b/Boss Sprites/TME_48.png new file mode 100644 index 0000000..653bcb2 Binary files /dev/null and b/Boss Sprites/TME_48.png differ diff --git a/Boss Sprites/TME_53.png b/Boss Sprites/TME_53.png new file mode 100644 index 0000000..27fa3d9 Binary files /dev/null and b/Boss Sprites/TME_53.png differ diff --git a/Boss Sprites/TME_55.png b/Boss Sprites/TME_55.png new file mode 100644 index 0000000..c46d7ac Binary files /dev/null and b/Boss Sprites/TME_55.png differ diff --git a/Boss Sprites/TME_63.png b/Boss Sprites/TME_63.png new file mode 100644 index 0000000..a845212 Binary files /dev/null and b/Boss Sprites/TME_63.png differ diff --git a/Boss Sprites/TME_68.png b/Boss Sprites/TME_68.png new file mode 100644 index 0000000..be4d8c1 Binary files /dev/null and b/Boss Sprites/TME_68.png differ diff --git a/Boss Sprites/TME_73.png b/Boss Sprites/TME_73.png new file mode 100644 index 0000000..6dc2587 Binary files /dev/null and b/Boss Sprites/TME_73.png differ diff --git a/Boss Sprites/TME_74.png b/Boss Sprites/TME_74.png new file mode 100644 index 0000000..74f294d Binary files /dev/null and b/Boss Sprites/TME_74.png differ diff --git a/Boss Sprites/TME_83.png b/Boss Sprites/TME_83.png new file mode 100644 index 0000000..b494973 Binary files /dev/null and b/Boss Sprites/TME_83.png differ diff --git a/Boss Sprites/TME_900000.png b/Boss Sprites/TME_900000.png new file mode 100644 index 0000000..a706733 Binary files /dev/null and b/Boss Sprites/TME_900000.png differ diff --git a/Boss Sprites/TME_999997.png b/Boss Sprites/TME_999997.png new file mode 100644 index 0000000..9409760 Binary files /dev/null and b/Boss Sprites/TME_999997.png differ diff --git a/Boss Sprites/TME_999999.png b/Boss Sprites/TME_999999.png new file mode 100644 index 0000000..8d22212 Binary files /dev/null and b/Boss Sprites/TME_999999.png differ diff --git a/Boss Sprites/Youmu_Never_Loses.png b/Boss Sprites/Youmu_Never_Loses.png new file mode 100644 index 0000000..c188d4f Binary files /dev/null and b/Boss Sprites/Youmu_Never_Loses.png differ diff --git a/sessions b/sessions new file mode 100644 index 0000000..e69de29 diff --git a/sigIRCv2.jar b/sigIRCv2.jar index b3eb47f..ae68b5f 100644 Binary files a/sigIRCv2.jar and b/sigIRCv2.jar differ diff --git a/src/sig/FileManager.java b/src/sig/FileManager.java index 8fe3605..35eb3ba 100644 --- a/src/sig/FileManager.java +++ b/src/sig/FileManager.java @@ -46,7 +46,7 @@ public class FileManager { if (!file.exists()) { System.out.println("Could not find "+file.getAbsolutePath()+", retrieving file online from "+serverURL+file.getName()+"."); try { - org.apache.commons.io.FileUtils.copyURLToFile(new URL(serverURL+fileloc),file); + org.apache.commons.io.FileUtils.copyURLToFile(new URL(serverURL.replaceAll(" ", "%20")+fileloc.replaceAll(" ", "%20")),file); if (file.exists()) { System.out.println(" >> Successfully downloaded "+file.getAbsolutePath()+"."); } diff --git a/src/sig/modules/TouhouMotherModule.java b/src/sig/modules/TouhouMotherModule.java index ec95074..6673319 100644 --- a/src/sig/modules/TouhouMotherModule.java +++ b/src/sig/modules/TouhouMotherModule.java @@ -15,12 +15,24 @@ import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import javax.imageio.ImageIO; import javax.swing.Timer; +import com.sun.jna.Memory; +import com.sun.jna.Pointer; +import com.sun.jna.platform.win32.Kernel32; +import com.sun.jna.platform.win32.WinNT; +import com.sun.jna.platform.win32.WinNT.HANDLE; + +import sig.FileManager; import sig.Module; import sig.sigIRC; +import sig.modules.RabiRibi.MemoryOffset; +import sig.modules.RabiRibi.MemoryType; import sig.modules.TouhouMother.DataProperty; import sig.modules.TouhouMother.IncreaseTouhouMotherClockCount; import sig.modules.TouhouMother.KillButton; @@ -31,6 +43,7 @@ import sig.modules.TouhouMother.TouhouMotherButton; import sig.modules.TouhouMother.TouhouMotherCharacterData; import sig.modules.TouhouMother.TouhouPlayerCharacter; import sig.modules.TouhouMother.UpdateButton; +import sig.modules.utils.PsapiTools; import sig.modules.utils.SemiValidInteger; import sig.modules.utils.SemiValidString; import sig.utils.DrawUtils; @@ -51,6 +64,11 @@ public class TouhouMotherModule extends Module implements ActionListener{ String real_gameData=SemiValidString.ERROR_VALUE; TouhouMotherBossData[] monsterDatabase; TouhouMotherCharacterData[] characterDatabase = new TouhouMotherCharacterData[4]; + final int PROCESS_PERMISSIONS = WinNT.PROCESS_QUERY_INFORMATION | WinNT.PROCESS_VM_READ; + boolean foundTouhouMother = false; + int touhouMotherPID = -1; + long touhouMotherMemOffset = 0; + public HANDLE touhouMotherProcess = null; public List recordDatabase = new ArrayList(); @@ -89,12 +107,92 @@ public class TouhouMotherModule extends Module implements ActionListener{ DisableTouhouMotherClockCount(); PopulateRecordDatabase(); DefineButton(); + ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + CheckTouhouMotherClient(); + scheduler.scheduleWithFixedDelay(()->{ + CheckTouhouMotherClient(); + }, 5000, 5000, TimeUnit.MILLISECONDS); + } + + private void CheckTouhouMotherClient() { + List pids; + try { + pids = PsapiTools.getInstance().enumProcesses(); + boolean found=false; + for (Integer pid : pids) { + HANDLE process = Kernel32.INSTANCE.OpenProcess(PROCESS_PERMISSIONS, true, pid); + List hModules; + try { + hModules = PsapiTools.getInstance().EnumProcessModules(process); + for(sig.modules.utils.Module m: hModules){ + /*if (m.getFileName().contains("rpg") || m.getFileName().contains("Touhou")) { + System.out.println(m.getFileName()+":"+m.getEntryPoint()); + }*/ + if (m.getFileName().contains("RPG_RT")) { + found=true; + if (!foundTouhouMother) { + touhouMotherMemOffset = Pointer.nativeValue(m.getLpBaseOfDll().getPointer()); + System.out.println("Found an instance of Touhou Mother at 0x"+Long.toHexString(touhouMotherMemOffset)+" | File:"+m.getFileName()+","+m.getBaseName()); + touhouMotherPID=pid; + foundTouhouMother=true; + touhouMotherProcess=process; + break; + } + break; + } + } + if (found) { + break; + } + } catch (Exception e) { + e.printStackTrace(); + } + if (process!=null) { + Kernel32.INSTANCE.CloseHandle(process); + } + } + if (!found && foundTouhouMother) { + foundTouhouMother=false; + System.out.println("Touhou Mother process lost."); + } + } catch (Exception e) { + e.printStackTrace(); + } } @Override public void actionPerformed(ActionEvent ev) { - memory = FileUtils.readFromFile(sigIRC.BASEDIR+"memory"); + //memory = FileUtils.readFromFile(sigIRC.BASEDIR+"memory"); //System.out.println(Arrays.toString(memory)); + memory = new String[19]; + + memory[0] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A84,0x6DC,0x2C0,0x8,0x6AC,0x2F0)); + memory[1] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A90,0x8,0x2E8,0x8,0x6AC,0x2F0)); + memory[2] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A88,0x454,0x310,0x8,0x6AC,0x2F0)); + memory[3] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A68,0x3B4,0x37C,0x8,0x6AC,0x2F0)); + memory[4] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A88,0x6C,0x400,0x8,0x6AC,0x2F0)); + memory[5] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2BA0,0x2B0,0x384,0x724,0x4D8,0x2DC)); + memory[6] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2BA0,0x584,0x308,0x6C0,0x73C,0x2D0)); + memory[7] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A90,0x40,0x5C,0x34,0x6D8,0x190)); + memory[8] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A58,0x410,0x734,0x424,0x6DC,0x2F0)); + memory[9] = ReadStringFromBuriedMemoryOffset(0xA2BD8,0x68,0xC,0x0,0x0); + memory[10] = ReadStringFromBuriedMemoryOffset(0xA2BD4,0x4,0x9C,0xC,0x0,0x0); + memory[11] = ReadStringFromBuriedMemoryOffset(0xA2B70,0x1F8,0x278,0xC,0x0,0x0); + memory[12] = ReadStringFromBuriedMemoryOffset(0xA2BD8,0x64,0x10,0x690,0x0,0x0); + memory[13] = ReadStringFromBuriedMemoryOffset(0xA2BD8,0x10,0x694,0x690,0x0,0x0); + memory[14] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2BA0,0x654,0x308,0x4D4,0x720,0x140)); + memory[15] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2BA0,0x27C,0x6FC,0x4D4,0x720,0x140)); + memory[16] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A58,0x144,0x728,0x5C,0x744,0x140)); + memory[17] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2BA0,0x1F4,0x774,0x72C,0x4F4,0x140)); + memory[18] = Integer.toString(ReadIntFromBuriedMemoryOffset(0xA2A80,0x44,0x5F0,0x2A8,0x3EC,0x2A0)); + + /*System.out.println("Value 1: "+readIntFromMemory(0xA2BD8)); + System.out.println("Value 2: "+readIntFromMemoryOffset(0x64,readIntFromMemory(0xA2BD8))); + System.out.println("Value 3: "+readIntFromMemoryOffset(0x10,readIntFromMemoryOffset(0x64,readIntFromMemory(0xA2BD8)))); + System.out.println("Value 4: "+readIntFromMemoryOffset(0x690,readIntFromMemoryOffset(0x10,readIntFromMemoryOffset(0x64,readIntFromMemory(0xA2BD8))))); + System.out.println("Value 5: "+readIntFromMemoryOffset(0x0,readIntFromMemoryOffset(0x690,readIntFromMemoryOffset(0x10,readIntFromMemoryOffset(0x64,readIntFromMemory(0xA2BD8)))))); + System.out.println("Value 6: "+readStringFromMemoryOffset(0x0,readIntFromMemoryOffset(0x0,readIntFromMemoryOffset(0x690,readIntFromMemoryOffset(0x10,readIntFromMemoryOffset(0x64,readIntFromMemory(0xA2BD8)))))));*/ + if (memory.length>=14) { ProcessMemoryData(); ValidateAndControlMonsterData(); @@ -109,6 +207,35 @@ public class TouhouMotherModule extends Module implements ActionListener{ killButton.run(); } + public int ReadIntFromBuriedMemoryOffset(long...offsets) { + int prev_val = 0; + for (int i=0;i