Legacy game saves now load, probably correctly
- Also fixed the file pick dialogs, which now return a path instead of a file:// URL
This commit is contained in:
@@ -236,8 +236,8 @@ namespace legacy {
|
|||||||
|
|
||||||
struct creature_data_type {
|
struct creature_data_type {
|
||||||
int16_t active,attitude;
|
int16_t active,attitude;
|
||||||
uint8_t number;
|
uint8_t number; // TODO: I think there should be a byte of padding near here, but where exactly??
|
||||||
location m_loc;
|
location m_loc __attribute__((aligned(2)));
|
||||||
monster_record_type m_d;
|
monster_record_type m_d;
|
||||||
int16_t mobile;
|
int16_t mobile;
|
||||||
int16_t summoned;
|
int16_t summoned;
|
||||||
@@ -251,8 +251,8 @@ namespace legacy {
|
|||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct outdoor_creature_type {
|
struct outdoor_creature_type {
|
||||||
Boolean exists;
|
Boolean exists; // TODO: I think there should be a byte of padding near here, but where exactly??
|
||||||
int16_t direction;
|
int16_t direction __attribute__((aligned(2)));
|
||||||
out_wandering_type what_monst;
|
out_wandering_type what_monst;
|
||||||
location which_sector,m_loc;
|
location which_sector,m_loc;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
@@ -975,7 +975,7 @@ bool load_party_v1(fs::path file_to_load, bool town_restore, bool in_scen, bool
|
|||||||
long len,store_len,count;
|
long len,store_len,count;
|
||||||
|
|
||||||
// LOAD PARTY
|
// LOAD PARTY
|
||||||
len = (long) sizeof(legacy::party_record_type); // 45368
|
len = (long) sizeof(legacy::party_record_type); // should be 46398
|
||||||
store_len = len;
|
store_len = len;
|
||||||
fin.read((char*)&store_party, len);
|
fin.read((char*)&store_party, len);
|
||||||
// error = FSRead(file_id, &len, (char *) &store_party)
|
// error = FSRead(file_id, &len, (char *) &store_party)
|
||||||
|
@@ -194,8 +194,9 @@ void init_fileio(){
|
|||||||
fs::path nav_get_scenario() {
|
fs::path nav_get_scenario() {
|
||||||
bool gotFile = [dlg_get_scen runModal] != NSFileHandlingPanelCancelButton;
|
bool gotFile = [dlg_get_scen runModal] != NSFileHandlingPanelCancelButton;
|
||||||
makeFrontWindow(mainPtr);
|
makeFrontWindow(mainPtr);
|
||||||
if(gotFile)
|
if(gotFile) {
|
||||||
return fs::path([[[dlg_get_scen URL] absoluteString] UTF8String]);
|
return fs::path([[[[dlg_get_scen URL] absoluteURL] path] UTF8String]);
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +204,7 @@ fs::path nav_put_scenario() {
|
|||||||
bool gotFile = [dlg_put_scen runModal] != NSFileHandlingPanelCancelButton;
|
bool gotFile = [dlg_put_scen runModal] != NSFileHandlingPanelCancelButton;
|
||||||
makeFrontWindow(mainPtr);
|
makeFrontWindow(mainPtr);
|
||||||
if(gotFile)
|
if(gotFile)
|
||||||
return [[[dlg_put_scen URL] absoluteString] UTF8String];
|
return fs::path([[[[dlg_put_scen URL] absoluteURL] path] UTF8String]);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +212,7 @@ fs::path nav_get_party() {
|
|||||||
bool gotFile = [dlg_get_game runModal] != NSFileHandlingPanelCancelButton;
|
bool gotFile = [dlg_get_game runModal] != NSFileHandlingPanelCancelButton;
|
||||||
makeFrontWindow(mainPtr);
|
makeFrontWindow(mainPtr);
|
||||||
if(gotFile)
|
if(gotFile)
|
||||||
return fs::path([[[dlg_get_game URL] absoluteString] UTF8String]);
|
return fs::path([[[[dlg_get_game URL] absoluteURL] path] UTF8String]);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +220,6 @@ fs::path nav_put_party() {
|
|||||||
bool gotFile = [dlg_put_game runModal] != NSFileHandlingPanelCancelButton;
|
bool gotFile = [dlg_put_game runModal] != NSFileHandlingPanelCancelButton;
|
||||||
makeFrontWindow(mainPtr);
|
makeFrontWindow(mainPtr);
|
||||||
if(gotFile)
|
if(gotFile)
|
||||||
return fs::path([[[dlg_put_game URL] absoluteString] UTF8String]);
|
return fs::path([[[[dlg_put_game URL] absoluteURL] path] UTF8String]);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user