Skip to content

Commit 27453a4

Browse files
fix bees
1 parent 682066e commit 27453a4

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

source/bo3macfix.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,18 @@ install_hook_name(HKAI_InitMapData, void, const char *mapname, char restart) {
202202
char physicsAltPath[0x200];
203203
snprintf(physicsPath, sizeof(physicsPath), "Physics/%s_navmesh.hkt", mapname);
204204
snprintf(physicsAltPath, sizeof(physicsAltPath), Macfix_Path "/Physics/%s_navmesh.hkt", mapname);
205-
if (access(physicsPath, F_OK) != 0 && access(physicsAltPath, F_OK) != 0) {
205+
206+
// bees are broken on Demon Within - don't trust the original navmesh/navvolume
207+
bool shouldFixBees = strcmp(mapname, "cp_mi_cairo_infection2") == 0;
208+
if ((access(physicsPath, F_OK) != 0 || (access(physicsPath, F_OK) == 0 && shouldFixBees))
209+
&& access(physicsAltPath, F_OK) != 0) {
206210
if (get_wine_path() == NULL)
207211
Com_Error(__FILE__, __LINE__, 2, Error_Prefix "You do not have Wine installed, so we can't convert the map '^2%s^7'.", mapname);
208-
char full_path[0x200];
209-
build_usermods_path(mapname, ".ff", 0x200, full_path, 2, (char *)(game_base_address + ADDR_g_workshopMapId));
210-
printf("map fastfile is '%s'\n", full_path);
212+
if (!shouldFixBees) {
213+
char full_path[0x200];
214+
build_usermods_path(mapname, ".ff", 0x200, full_path, 2, (char *)(game_base_address + ADDR_g_workshopMapId));
215+
printf("map fastfile is '%s'\n", full_path);
216+
}
211217

212218
char xasset_path[0x200];
213219
snprintf(xasset_path, 0x200, "maps/%s/%s_navmesh", GetGamemodeString(), mapname);
@@ -378,11 +384,11 @@ void IOHIDDeviceUnscheduleFromRunLoop_new(IOHIDDeviceRef device, CFRunLoopRef ru
378384
}
379385
DYLD_INTERPOSE(IOHIDDeviceUnscheduleFromRunLoop_new, IOHIDDeviceUnscheduleFromRunLoop);
380386

381-
// this will get called lots in SDL2.0.7's JoystickDeviceWasAddedCallback, so filter for PrimaryUsagePage
387+
// this will get called lots in SDL2.0.7's JoystickDeviceWasAddedCallback, so filter for PrimaryUsage
382388
CFTypeRef IOHIDDeviceGetProperty_hook(IOHIDDeviceRef device, CFStringRef key)
383389
{
384390
CFTypeRef orig = IOHIDDeviceGetProperty(device, key);
385-
// that address is the CFString for PrimaryUsagePage
391+
// that address is the CFString for PrimaryUsage
386392
if (orig != NULL && key == (void *)(game_base_address + 0x1b8b420))
387393
{
388394
//printf("device = %p\n", device);
@@ -626,6 +632,10 @@ __attribute__((constructor)) static void dylib_main() {
626632
memset(curl_nops, 0x90, sizeof(curl_nops));
627633
DobbyCodePatch((void *)(game_base_address + ADDR_Curl_ContentLengthSetStart), curl_nops, sizeof(curl_nops));
628634

635+
// replace the strcmp where HKAI_InitMapData checks to see if the map name is cp_mi_cairo_infection2
636+
uint8_t return_0[] = { 0xB8, 0, 0, 0, 0};
637+
DobbyCodePatch((void *)(game_base_address + ADDR_HKAI_InitMapData_DemonWithinCheck), return_0, sizeof(return_0));
638+
629639
// patches the network version to match Windows
630640
network_version_patch();
631641

source/offsets.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@
3838
#define ADDR_LPC_GetRemoteManifest_Category_Inst 0xEA8C04 // mid-func
3939
#define ADDR_Live_SystemInfo_LarpInstr 0x129dbcc // mid-func
4040
#define ADDR_LobbyHostMsg_SendJoinRequest_GetChangelistCall 0x1232458 // mid-func
41+
#define ADDR_HKAI_InitMapData_DemonWithinCheck 0xe09f68 // mid-func
4142
// -- END OFFSETS

source/versioninfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#define MACFIX_VERSION "1.2-beta2"
1+
#define MACFIX_VERSION "1.2-beta3"
22
//#define MACFIX_DEBUG 1

0 commit comments

Comments
 (0)