geokar2006 / ByNameModding

MOVED https://github.com/ByNameModding/BNM-Android
113 stars 34 forks source link

Array, List or Dictionary cannot store pointers/addresses #29

Closed im-bay closed 1 year ago

im-bay commented 1 year ago

i am trying to get Dictionary , and its value is a class. I hope the value is like an address (void * or uint64_t), but the value goes to another address.

//......
    //monoDictionary<monoString*,/*SkinData*/void*>
    // public class SkinData {
    //   public byte skinID; // 0xC 
    // ...
    auto skins = GetSkins(thiz);
    LOGI("=== SkinKeys");
    for(auto key : skins->getKeys()){
        // ok
        LOGI("Skin Name: %s",key->c_str());
    }
    LOGI("=== SkinValues");
    for(auto data : skins->getValues()){
        // here the game crashed
        uint8_t skin_Id = *(uint8_t *)((uint64_t) data + 0xC);
        LOGI("SkinData.Id: %d",(int)skin_id);
    }
//......