Beispiel #1
0
        public static long getOffsetOfSubBar(long barAddress, string name)
        {
            int  baseOffset = getBarBaseOffsetFromAddress(barAddress);
            long offset     = -1;

            // For each subBar file
            for (int i = 0; i < getBarCountFromAddress(barAddress); i++)
            {
                long   subBarAddress = barAddress + 16 + (i * 16);
                string subBarName    = System.Text.Encoding.ASCII.GetString(readPcsx2(subBarAddress + 4, 4).ToArray());
                long   subBarOffset  = BinaryHandler.bytesAsInt(readPcsx2(subBarAddress + 8, 4));
                if (subBarName == name)
                {
                    offset = subBarOffset;
                }
            }
            switch (process_current_Type)
            {
            case ProcessType.PCSX2: return(offset - baseOffset);

            case ProcessType.EGS: return(offset - baseOffset);

            default: return(-1);
            }
        }
Beispiel #2
0
 public void act_read()
 {
     Console.WriteLine("DEBUG > StatsPageHandler > Reading...");
     HP_Max         = BinaryHandler.bytesAsInt(Pcsx2Memory.readPcsx2(long.Parse(HP_Max_MEM, System.Globalization.NumberStyles.HexNumber), HP_Max_Size));
     HP_Current     = BinaryHandler.bytesAsInt(Pcsx2Memory.readPcsx2(long.Parse(HP_Current_MEM, System.Globalization.NumberStyles.HexNumber), HP_Current_Size));
     MP_Max         = BinaryHandler.bytesAsInt(Pcsx2Memory.readPcsx2(long.Parse(MP_Max_MEM, System.Globalization.NumberStyles.HexNumber), MP_Max_Size));
     MP_Current     = BinaryHandler.bytesAsInt(Pcsx2Memory.readPcsx2(long.Parse(MP_Current_MEM, System.Globalization.NumberStyles.HexNumber), MP_Current_Size));
     Drive_Max      = Pcsx2Memory.readPcsx2(long.Parse(Drive_Max_MEM, System.Globalization.NumberStyles.HexNumber), Drive_Max_Size)[0];
     Drive_Current  = Pcsx2Memory.readPcsx2(long.Parse(Drive_Current_MEM, System.Globalization.NumberStyles.HexNumber), Drive_Current_Size)[0];
     Munny          = BinaryHandler.bytesAsInt(Pcsx2Memory.readPcsx2(long.Parse(Munny_MEM, System.Globalization.NumberStyles.HexNumber), Munny_Size));
     AP_Boost       = Pcsx2Memory.readPcsx2(long.Parse(AP_Boost_MEM, System.Globalization.NumberStyles.HexNumber), AP_Boost_Size)[0];
     Strength       = BinaryHandler.bytesAsUShort(Pcsx2Memory.readPcsx2(long.Parse(Strength_MEM, System.Globalization.NumberStyles.HexNumber), Strength_Size));
     Strength_Boost = Pcsx2Memory.readPcsx2(long.Parse(Strength_Boost_MEM, System.Globalization.NumberStyles.HexNumber), Strength_Boost_Size)[0];
     Magic          = BinaryHandler.bytesAsUShort(Pcsx2Memory.readPcsx2(long.Parse(Magic_MEM, System.Globalization.NumberStyles.HexNumber), Magic_Size));
     Magic_Boost    = Pcsx2Memory.readPcsx2(long.Parse(Magic_Boost_MEM, System.Globalization.NumberStyles.HexNumber), Magic_Boost_Size)[0];
     Defense        = BinaryHandler.bytesAsUShort(Pcsx2Memory.readPcsx2(long.Parse(Defense_MEM, System.Globalization.NumberStyles.HexNumber), Defense_Size));
     Defense_Boost  = Pcsx2Memory.readPcsx2(long.Parse(Defense_Boost_MEM, System.Globalization.NumberStyles.HexNumber), Defense_Boost_Size)[0];
     PhysRes        = Pcsx2Memory.readPcsx2(long.Parse(PhysRes_MEM, System.Globalization.NumberStyles.HexNumber), PhysRes_Size)[0];
     FireRes        = Pcsx2Memory.readPcsx2(long.Parse(FireRes_MEM, System.Globalization.NumberStyles.HexNumber), FireRes_Size)[0];
     BlizRes        = Pcsx2Memory.readPcsx2(long.Parse(BlizRes_MEM, System.Globalization.NumberStyles.HexNumber), BlizRes_Size)[0];
     ThunRes        = Pcsx2Memory.readPcsx2(long.Parse(ThunRes_MEM, System.Globalization.NumberStyles.HexNumber), ThunRes_Size)[0];
     DarkRes        = Pcsx2Memory.readPcsx2(long.Parse(DarkRes_MEM, System.Globalization.NumberStyles.HexNumber), DarkRes_Size)[0];
     NeutRes        = Pcsx2Memory.readPcsx2(long.Parse(NeutRes_MEM, System.Globalization.NumberStyles.HexNumber), NeutRes_Size)[0];
     GeneRes        = Pcsx2Memory.readPcsx2(long.Parse(GeneRes_MEM, System.Globalization.NumberStyles.HexNumber), GeneRes_Size)[0];
     Console.WriteLine("DEBUG > StatsPageHandler > Finished reading!");
 }
Beispiel #3
0
        public static long findBarFileAddressMagi(String text)
        {
            long fileAddress = findAddressOf(text);

            //Debug.WriteLine("DELETE DEBUG > fileAddress: " + fileAddress);
            if (fileAddress == -1)
            {
                return(-1);
            }

            //Debug.WriteLine("DELETE DEBUG > string found: " + BinaryHandler.bytesAsString(readPcsx2(fileAddress, 4)));

            // Memory address pointer
            fileAddress += 4;

            int barFilePointer = BinaryHandler.bytesAsInt(readPcsx2(fileAddress, 4));

            //Debug.WriteLine("DELETE DEBUG > barFilePointer: " + barFilePointer);

            long initialAddress = 0;

            if (process_current_Type == ProcessType.PCSX2)
            {
                initialAddress = startingAddress;
            }
            if (process_current_Type == ProcessType.EGS)
            {
                initialAddress = startingAddressEGS;
            }

            return(initialAddress + barFilePointer);
        }
Beispiel #4
0
        public static long getFileOffset(FileType fileType)
        {
            findProcess();
            if (process_current == null)
            {
                return(-1);
            }

            switch (process_current_Type)
            {
            case ProcessType.PCSX2:
            {
                switch (fileType)
                {
                case FileType.KH2_03SYSTEM: return((long)BinaryHandler.bytesAsInt(readPcsx2(startingAddress + (long)FilePointer.KH2_03SYSTEM_PCSX2, 4)));

                case FileType.KH2_00BATTLE: return((long)BinaryHandler.bytesAsInt(readPcsx2(startingAddress + (long)FilePointer.KH2_00BATTLE_PCSX2, 4)));

                case FileType.KH2_00OBJENTRY: return((long)BinaryHandler.bytesAsInt(readPcsx2(startingAddress + (long)FilePointer.KH2_00OBJENTRY_PCSX2, 4)));

                case FileType.KH2_JIMINY: return((long)BinaryHandler.bytesAsInt(readPcsx2(startingAddress + (long)FilePointer.KH2_JIMINY_PCSX2, 4)));

                case FileType.KH2_MIXDATA: return((long)BinaryHandler.bytesAsInt(readPcsx2(startingAddress + (long)FilePointer.KH2_MIXDATA_PCSX2, 4)));

                default: return(-1);
                }
            }

            case ProcessType.EGS:
            {
                switch (fileType)
                {
                case FileType.KH2_03SYSTEM: return(BinaryHandler.bytesAsLong(readPcsx2(startingAddressEGS + (long)FilePointer.KH2_03SYSTEM_EGS, 8)) - startingAddressEGS);

                case FileType.KH2_00BATTLE: return(BinaryHandler.bytesAsLong(readPcsx2(startingAddressEGS + (long)FilePointer.KH2_00BATTLE_EGS, 8)) - startingAddressEGS);

                case FileType.KH2_00OBJENTRY: return(BinaryHandler.bytesAsLong(readPcsx2(startingAddressEGS + (long)FilePointer.KH2_00OBJENTRY_EGS, 8)) - startingAddressEGS);

                //case FileType.KH2_JIMINY: return (BinaryHandler.bytesAsLong(readPcsx2(startingAddressEGS + (long)FilePointer.KH2_JIMINY_EGS, 8)) - startingAddressEGS);
                case FileType.KH2_MIXDATA: return(BinaryHandler.bytesAsLong(readPcsx2(startingAddressEGS + (long)FilePointer.KH2_MIXDATA_EGS, 8)) - startingAddressEGS);

                default: return(-1);
                }
            }

            default: return(-1);
            }
        }
Beispiel #5
0
 public static int getBarBaseOffsetFromAddress(long address)
 {
     return(BinaryHandler.bytesAsInt(readPcsx2(address + 8, 4)));
 }
Beispiel #6
0
 public static int getBarCountFromAddress(long address)
 {
     return(BinaryHandler.bytesAsInt(readPcsx2(address + 4, 4)));
 }
Beispiel #7
0
 public static int getBARFileOffset(long BARAddress)
 {
     return(BinaryHandler.bytesAsInt(readPcsx2(BARAddress + 8, 4)));
 }