mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fixes to object loading
This commit is contained in:
parent
340997b365
commit
ded905a259
|
@ -32,6 +32,8 @@
|
|||
|
||||
#if defined(__i386__) || defined(_M_IX86)
|
||||
#define PLATFORM_X86
|
||||
#else
|
||||
#define NO_RCT2 1
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__) || defined(_WIN64)
|
||||
|
|
20
src/object.c
20
src/object.c
|
@ -822,15 +822,6 @@ static uint8* object_type_ride_load(void *objectEntry, uint32 entryIndex, int *c
|
|||
cur_vehicle_images_offset = image_index + vehicleEntry->no_seating_rows * vehicleEntry->no_vehicle_images;
|
||||
// 0x6DEB0D
|
||||
|
||||
if (!(vehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_10)) {
|
||||
int num_images = cur_vehicle_images_offset - vehicleEntry->base_image_id;
|
||||
if (vehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_13) {
|
||||
num_images *= 2;
|
||||
}
|
||||
|
||||
set_vehicle_type_image_max_sizes(vehicleEntry, num_images);
|
||||
}
|
||||
|
||||
// Copy the vehicle entry over to new one
|
||||
outVehicleEntry->rotation_frame_mask = vehicleEntry->rotation_frame_mask;
|
||||
outVehicleEntry->var_02 = vehicleEntry->var_02;
|
||||
|
@ -876,6 +867,15 @@ static uint8* object_type_ride_load(void *objectEntry, uint32 entryIndex, int *c
|
|||
outVehicleEntry->draw_order = vehicleEntry->draw_order;
|
||||
outVehicleEntry->special_frames = vehicleEntry->special_frames;
|
||||
|
||||
if (!(vehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_10)) {
|
||||
int num_images = cur_vehicle_images_offset - vehicleEntry->base_image_id;
|
||||
if (vehicleEntry->flags_a & VEHICLE_ENTRY_FLAG_A_13) {
|
||||
num_images *= 2;
|
||||
}
|
||||
|
||||
set_vehicle_type_image_max_sizes(outVehicleEntry, num_images);
|
||||
}
|
||||
|
||||
sint8 no_positions = *peep_loading_positions++;
|
||||
if (no_positions == -1) {
|
||||
// The no_positions is 16 bit skip over
|
||||
|
@ -2322,7 +2322,7 @@ static rct_string_id object_type_park_entrance_desc(void *objectEntry)
|
|||
return STR_NONE;
|
||||
}
|
||||
|
||||
static bool object_type_park_entrance_reset(void *objectEntry, uint32 entryIndex)
|
||||
static void object_type_park_entrance_reset(void *objectEntry, uint32 entryIndex)
|
||||
{
|
||||
rct_entrance_type *entranceType = (rct_entrance_type*)objectEntry;
|
||||
uint8 *extendedEntryData = (uint8*)((size_t)objectEntry + sizeof(rct_entrance_type));
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
#endif // defined(__unix__)
|
||||
|
||||
int gExitCode;
|
||||
int fdData;
|
||||
void *segments;
|
||||
|
||||
int gOpenRCT2StartupAction = STARTUP_ACTION_TITLE;
|
||||
utf8 gOpenRCT2StartupActionPath[512] = { 0 };
|
||||
|
@ -338,6 +340,8 @@ void openrct2_dispose()
|
|||
language_close_all();
|
||||
rct2_dispose();
|
||||
config_release();
|
||||
munmap(segments, 16941056);
|
||||
close(fdData);
|
||||
platform_free();
|
||||
}
|
||||
|
||||
|
@ -524,6 +528,19 @@ bool openrct2_setup_rct2_segment()
|
|||
int pageSize = getpagesize();
|
||||
int numPages = (len + pageSize - 1) / pageSize;
|
||||
unsigned char *dummy = malloc(numPages);
|
||||
|
||||
fdData = open("openrct2_load", O_RDONLY);
|
||||
if (fdData < 0)
|
||||
{
|
||||
log_fatal("failed to load rct2 data. cat openrct2_text openrct2_data > openrct2_load");
|
||||
exit(1);
|
||||
}
|
||||
segments = mmap((void*)0x401000, 16941056, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fdData, 0);
|
||||
if (segments != (void*)0x401000)
|
||||
{
|
||||
log_fatal("mmap failed");
|
||||
exit(1);
|
||||
}
|
||||
int err = mincore((void *)0x8a4000, len, dummy);
|
||||
bool pagesMissing = false;
|
||||
if (err != 0)
|
||||
|
|
Loading…
Reference in New Issue