Skip to content

Commit

Permalink
Merge from official v13.2 and bump version date
Browse files Browse the repository at this point in the history
  • Loading branch information
R-YaTian committed Sep 30, 2024
1 parent 573616b commit cad11c2
Show file tree
Hide file tree
Showing 30 changed files with 634 additions and 472 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ about: Use this to report bugs you encounter with Luma3DS. Make sure you upload

**Luma3DS version:**

[e.g. v13.1.2 stable or if using non-releases specify the commit like this https://github.com/LumaTeam/Luma3DS/commit/988ec17ebfce513fc4589f7b12e0d6e3894ae542]
[e.g. v13.2 stable or if using non-releases specify the commit like this https://github.com/LumaTeam/Luma3DS/commit/988ec17ebfce513fc4589f7b12e0d6e3894ae542]

**Luma3DS configuration/options:**

Expand Down
10 changes: 8 additions & 2 deletions k11_extension/include/svc/MapProcessMemoryEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,11 @@
#include "kernel.h"
#include "svc.h"

Result MapProcessMemoryEx(Handle dstProcessHandle, u32 vaDst, Handle srcProcessHandle, u32 vaSrc, u32 size);
Result MapProcessMemoryExWrapper(Handle dstProcessHandle, u32 vaDst, Handle srcProcessHandle, u32 vaSrc, u32 size);
/// Flags for svcMapProcessMemoryEx
typedef enum MapExFlags
{
MAPEXFLAGS_PRIVATE = BIT(0), ///< Maps the memory as PRIVATE (0xBB05) instead of SHARED (0x5806)
} MapExFlags;

Result MapProcessMemoryEx(Handle dstProcessHandle, u32 vaDst, Handle srcProcessHandle, u32 vaSrc, u32 size, MapExFlags flags);
Result MapProcessMemoryExWrapper(Handle dstProcessHandle, u32 vaDst, Handle srcProcessHandle, u32 vaSrc, u32 size, MapExFlags flags);
4 changes: 2 additions & 2 deletions k11_extension/source/svc/MapProcessMemoryEx.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "svc/MapProcessMemoryEx.h"

Result MapProcessMemoryEx(Handle dstProcessHandle, u32 vaDst, Handle srcProcessHandle, u32 vaSrc, u32 size)
Result MapProcessMemoryEx(Handle dstProcessHandle, u32 vaDst, Handle srcProcessHandle, u32 vaSrc, u32 size, MapExFlags flags)
{
Result res = 0;
u32 sizeInPage = size >> 12;
Expand Down Expand Up @@ -69,7 +69,7 @@ Result MapProcessMemoryEx(Handle dstProcessHandle, u32 vaDst, Handle srcProcess
// Check if the destination address is free and large enough
res = KProcessHwInfo__CheckVaState(hwInfoOfProcess(dstProcess), vaDst, size, 0, 0);
if (res == 0)
res = KProcessHwInfo__MapListOfKBlockInfo(hwInfoOfProcess(dstProcess), vaDst, &list, 0x5806, MEMPERM_RW | 0x18, 0);
res = KProcessHwInfo__MapListOfKBlockInfo(hwInfoOfProcess(dstProcess), vaDst, &list, (flags & MAPEXFLAGS_PRIVATE) ? 0xBB05 : 0x5806, MEMPERM_RW | 0x18, 0);
}

KLinkedList_KBlockInfo__Clear(&list);
Expand Down
10 changes: 7 additions & 3 deletions k11_extension/source/svc/wrappers.s
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ ControlMemoryUnsafeWrapper:
.global MapProcessMemoryExWrapper
.type MapProcessMemoryExWrapper, %function
MapProcessMemoryExWrapper:
push {lr}
push {r5, lr} @ We need to save r5 because the old implementation doesn't save it
cmp r0, #0xFFFFFFF2 @ Check magic value, for backwards compatibility
moveq r0, r6 @ If value present, flags present in r5 and dst process in r6, so move dst process back to r0
movne r5, #0 @ If value not present, clear the flags as its the old version
str r5, [sp, #-4]!
str r4, [sp, #-4]!
bl MapProcessMemoryEx
add sp, #4
pop {pc}
add sp, #8
pop {r5, pc}
4 changes: 3 additions & 1 deletion sysmodules/loader/source/ifile.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Result IFile_OpenFromArchive(IFile *file, FS_Archive archive, FS_Path filePath,

Result IFile_Close(IFile *file)
{
return FSFILE_Close(file->handle);
Result res = file->handle != 0 ? FSFILE_Close(file->handle) : 0;
file->handle = 0;
return res;
}

Result IFile_GetSize(IFile *file, u64 *size)
Expand Down
10 changes: 9 additions & 1 deletion sysmodules/rosalina/include/csvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,23 @@ void svcInvalidateEntireInstructionCache(void);

///@name Memory management
///@{

/// Flags for svcMapProcessMemoryEx
typedef enum MapExFlags
{
MAPEXFLAGS_PRIVATE = BIT(0), ///< Maps the memory as PRIVATE (0xBB05) instead of SHARED (0x5806)
} MapExFlags;

/**
* @brief Maps a block of process memory.
* @param dstProcessHandle Handle of the process to map the memory in (destination)
* @param destAddress Start address of the memory block in the destination process
* @param srcProcessHandle Handle of the process to map the memory from (source)
* @param srcAddress Start address of the memory block in the source process
* @param size Size of the block of the memory to map (truncated to a multiple of 0x1000 bytes)
* @param flags Extended flags for mapping the memory (see MapExFlags)
*/
Result svcMapProcessMemoryEx(Handle dstProcessHandle, u32 destAddress, Handle srcProcessHandle, u32 srcAddress, u32 size);
Result svcMapProcessMemoryEx(Handle dstProcessHandle, u32 destAddress, Handle srcProcessHandle, u32 srcAddress, u32 size, MapExFlags flags);

/**
* @brief Unmaps a block of process memory.
Expand Down
7 changes: 7 additions & 0 deletions sysmodules/rosalina/include/gdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#include "memory.h"
#include "ifile.h"

// Uncomment the line below to dump GDB communications to a file
//#define DEBUG_GDB_COMMUNICATIONS

#define MAX_DEBUG 3
#define MAX_DEBUG_THREAD 127
#define MAX_BREAKPOINT 64
Expand Down Expand Up @@ -154,6 +157,10 @@ typedef struct GDBContext

char memoryOsInfoXmlData[0x800];
char processesOsInfoXmlData[0x1800];

#ifdef DEBUG_GDB_COMMUNICATIONS
IFile debugFile;
#endif
} GDBContext;

typedef int (*GDBCommandHandler)(GDBContext *ctx);
Expand Down
1 change: 1 addition & 0 deletions sysmodules/rosalina/include/ifile.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ Result IFile_GetSize(IFile *file, u64 *size);
Result IFile_SetSize(IFile *file, u64 size);
Result IFile_Read(IFile *file, u64 *total, void *buffer, u32 len);
Result IFile_Write(IFile *file, u64 *total, const void *buffer, u32 len, u32 flags);
Result IFile_Flush(IFile *file);
3 changes: 2 additions & 1 deletion sysmodules/rosalina/include/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ typedef struct Menu {

extern u32 menuCombo;
extern bool isHidInitialized;
extern bool isQtmInitialized;
extern u32 mcuFwVersion;
extern u8 mcuInfoTable[9];
extern u8 mcuInfoTable[10];
extern bool mcuInfoTableRead;
extern const char *topScreenType;
extern const char *bottomScreenType;
Expand Down
7 changes: 4 additions & 3 deletions sysmodules/rosalina/include/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@
extern Menu rosalinaMenu;

void RosalinaMenu_TakeScreenshot(void);
void RosalinaMenu_ChangeScreenBrightness(void);
void RosalinaMenu_ShowCredits(void);
void RosalinaMenu_AboutCnVer(void);
void RosalinaMenu_ProcessList(void);
void RosalinaMenu_SaveSettings(void);
void RosalinaMenu_PowerOff(void);
void RosalinaMenu_Reboot(void);
void RosalinaMenu_Cheats(void);

void RosalinaMenu_PowerOffOrReboot(void);

void RosalinaMenu_ShowSystemInfo();

bool rosalinaMenuShouldShowDebugInfo(void);
void RosalinaMenu_ShowDebugInfo(void);

void menuTakeSelfScreenshot(void);
6 changes: 6 additions & 0 deletions sysmodules/rosalina/include/menus/n3ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@

extern Menu N3DSMenu;

bool N3DSMenu_CheckNotN2dsXl(void);

void N3DSMenu_UpdateStatus(void);
void N3DSMenu_ChangeClockRate(void);
void N3DSMenu_EnableDisableL2Cache(void);

void N3DSMenu_ToggleSs3d(void);
void N3DSMenu_TestBarrierPositions(void);
void N3DSMenu_Ss3dCalibration(void);
Loading

0 comments on commit cad11c2

Please sign in to comment.