From ccc87081f3a6495eee101a5f7dec1b675a1d4db5 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 17 Sep 2017 14:14:15 +0300 Subject: [PATCH] Rewrite _sys_strcmp --- rpcs3/Emu/Cell/Modules/sys_libc_.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/Modules/sys_libc_.cpp b/rpcs3/Emu/Cell/Modules/sys_libc_.cpp index 321f89c815..aa3c211719 100644 --- a/rpcs3/Emu/Cell/Modules/sys_libc_.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_libc_.cpp @@ -211,7 +211,16 @@ s32 _sys_strcmp(vm::cptr str1, vm::cptr str2) { sysPrxForUser.trace("_sys_strcmp(str1=%s, str2=%s)", str1, str2); - return std::strcmp(str1.get_ptr(), str2.get_ptr()); + for (u32 i = 0;; i++) + { + const u8 ch1 = str1[i], ch2 = str2[i]; + if (ch1 < ch2) + return -1; + if (ch1 > ch2) + return 1; + if (ch1 == '\0') + return 0; + } } s32 _sys_strncmp(vm::cptr str1, vm::cptr str2, s32 max)