Skip to content

Instantly share code, notes, and snippets.

View zachhilman's full-sized avatar
🐉
Focusing

Zach Hilman zachhilman

🐉
Focusing
View GitHub Profile
@zachhilman
zachhilman / out.patch
Created June 19, 2018 02:31
Nca Changes patch
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp
index e0a9458f..53110faa 100644
--- a/src/core/loader/nca.cpp
+++ b/src/core/loader/nca.cpp
@@ -20,15 +20,15 @@
namespace Loader {
-enum NcaContentType {
- NCT_PROGRAM = 0,
[ 161.779467] Debug.Emulated <Info> core\hle\service\lm\lm.cpp:Log:147: D:/home/TokyoProject/RedStar/Library/sead/engine/library/modules/src/basis/nin/seadRawPrintNin.cpp:PrintStringImpl:18:
User Backtrace
[ 162.003913] Debug.Emulated <Info> core\hle\service\lm\lm.cpp:Log:147: D:/home/TokyoProject/RedStar/Library/sead/engine/library/modules/src/basis/nin/seadRawPrintNin.cpp:PrintStringImpl:18: 0x0000000008b5fad0 (unknown)
[ 162.014852] Debug.Emulated <Info> core\hle\service\lm\lm.cpp:Log:147: D:/home/TokyoProject/RedStar/Library/sead/engine/library/modules/src/basis/nin/seadRawPrintNin.cpp:PrintStringImpl:18: 0x000000000acac2e8 (unknown)
[ 162.015512] Debug.Emulated <Info> core\hle\service\lm\lm.cpp:Log:147: D:/home/TokyoProject/RedStar/Library/sead/engine/library/modules/src/basis/nin/seadRawPrintNin.cpp:PrintStringImpl:18: 0x000000000acab050 (unknown)
[ 162.016090] Debug.Emulated <Info> core\hle\service\lm\lm.cpp:Log:147: D:/home/TokyoProject/RedStar/Library/sead/engine/library/modules/src/basis/n
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp
index 82e8c604..a917fd0b 100644
--- a/src/core/file_sys/vfs.cpp
+++ b/src/core/file_sys/vfs.cpp
@@ -53,7 +53,8 @@ std::shared_ptr<VfsFile> VfsDirectory::GetFileRelative(const filesystem::path& p
return GetFile(path.filename().string());
auto parent = path.parent_path().string();
- parent.replace(path.root_path().string().begin(), path.root_path().string().end(), "");
+ auto root = path.root_path().string();
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp
index 82e8c604..a917fd0b 100644
--- a/src/core/file_sys/vfs.cpp
+++ b/src/core/file_sys/vfs.cpp
@@ -53,7 +53,8 @@ std::shared_ptr<VfsFile> VfsDirectory::GetFileRelative(const filesystem::path& p
return GetFile(path.filename().string());
auto parent = path.parent_path().string();
- parent.replace(path.root_path().string().begin(), path.root_path().string().end(), "");
+ auto root = path.root_path().string();
Function / Call Stack CPU Time Module Function (Full) Source File Start Address
fputs 94.131 ucrtbase.dll fputs [Unknown] 0x180004a00
SetConsoleTextAttribute 90.1951 KERNELBASE.dll SetConsoleTextAttribute [Unknown] 0x1800770a0
GetConsoleScreenBufferInfo 69.6486 KERNELBASE.dll GetConsoleScreenBufferInfo [Unknown] 0x180008870
page_flush_tb_1_aarch64 46.7698 unicorn.dll page_flush_tb_1_aarch64 translate-all.c 0x6b089117
invalidate_page_bitmap_aarch64 23.9179 unicorn.dll invalidate_page_bitmap_aarch64 translate-all.c 0x6b0890d0
[Outside any known module] 21.1967 [Unknown] [Outside any known module] [Unknown] 0
memset 18.1418 msvcrt.dll memset [Unknown] 0x110174600
func@0x69c73ec0 16.9936 nvoglv64.dll func@0x69c73ec0 [Unknown] 0x69c73ec0
tcg_constant_folding_aarch64 16.9699 unicorn.dll tcg_constant_folding_aarch64 optimize.c 0x6b07baa4

All the random RomFS requests for title ids not in current process.

Cave Story

0000 0000 0000 0000 (x2)

Binding of Isaac

0000 0000 0000 0000 (x2)

Odyssey

None

std::string mode_str;
u32 mode_flags = static_cast<u32>(mode);
// Calculate the correct open mode for the file.
if ((mode_flags & static_cast<u32>(Mode::Read)) &&
(mode_flags & static_cast<u32>(Mode::Write))) {
if (mode_flags & static_cast<u32>(Mode::Append))
mode_str = "a+";
else
mode_str = "r+";
diff --git a/src/core/file_sys/mode.h b/src/core/file_sys/mode.h
index b436315..6d40ad5 100644
--- a/src/core/file_sys/mode.h
+++ b/src/core/file_sys/mode.h
@@ -14,4 +14,6 @@ enum class Mode : u32 {
Append = 4,
};
+constexpr Mode MODE_RW = static_cast<Mode>(3);
+
@zachhilman
zachhilman / tsan2
Created August 12, 2018 22:15
tsan2
This file has been truncated, but you can view the full file.
==================
WARNING: ThreadSanitizer: data race (pid=14219)
Read of size 1 at 0x7b04000098c0 by thread T2:
#0 strlen <null> (libtsan.so.0+0x315c5)
#1 pthread_setname_np <null> (libpthread.so.0+0x1391c)
#2 <null> <null> (libglib-2.0.so.0+0x73ded)
Previous write of size 8 at 0x7b04000098c0 by main thread (mutexes: write M221):
#0 malloc <null> (libtsan.so.0+0x2afa3)
#1 g_malloc <null> (libglib-2.0.so.0+0x51858)
AddressSanitizer:DEADLYSIGNAL
=================================================================
==4792==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fbb3644e5e8 bp 0x7fbae4f168c0 sp 0x7fbae4f16028 T7)
==4792==The signal is caused by a WRITE memory access.
==4792==Hint: address points to the zero page.
#0 0x7fbb3644e5e7 (/lib/x86_64-linux-gnu/libc.so.6+0xbb5e7)
#1 0x7fbb396c2eb2 (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x3feb2)
#2 0x55f8f004614f in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
#3 0x55f8f004614f in Memory::ReadBlock(Kernel::Process const&, unsigned long, void*, unsigned long) /home/zachhilman/CLionProjects/yuzu/src/core/memory.cpp:418
#4 0x55f8f057e8ac in RasterizerOpenGL::UploadMemory(unsigned char*, long, unsigned long, unsigned long, unsigned long) /home/zachhilman/CLionProjects/yuzu/src/video_core/renderer_opengl/gl_rasterizer.cpp:417