mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	SVC: Cleaned up function wrappers to pass in correct argument types.
This commit is contained in:
		
							parent
							
								
									bfdd874b1f
								
							
						
					
					
						commit
						862db811f0
					
				
					 2 changed files with 232 additions and 901 deletions
				
			
		|  | @ -1,19 +1,6 @@ | |||
| // Copyright (c) 2012- PPSSPP Project.
 | ||||
| 
 | ||||
| // This program is free software: you can redistribute it and/or modify
 | ||||
| // it under the terms of the GNU General Public License as published by
 | ||||
| // the Free Software Foundation, version 2.0 or later versions.
 | ||||
| 
 | ||||
| // This program is distributed in the hope that it will be useful,
 | ||||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | ||||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | ||||
| // GNU General Public License 2.0 for more details.
 | ||||
| 
 | ||||
| // A copy of the GPL 2.0 should have been included with the program.
 | ||||
| // If not, see http://www.gnu.org/licenses/
 | ||||
| 
 | ||||
| // Official git repository and contact information can be found at
 | ||||
| // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
 | ||||
| // Copyright 2014 Citra Emulator Project
 | ||||
| // Licensed under GPLv2
 | ||||
| // Refer to the license.txt file included.
 | ||||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
|  | @ -21,759 +8,113 @@ | |||
| #include "core/mem_map.h" | ||||
| #include "core/hle/hle.h" | ||||
| 
 | ||||
| // For easy parameter parsing and return value processing.
 | ||||
| namespace Wrap { | ||||
| 
 | ||||
| //32bit wrappers
 | ||||
| template<void func()> void WrapV_V() { | ||||
|     func(); | ||||
| } | ||||
| 
 | ||||
| template<u32 func()> void WrapU_V() { | ||||
|     RETURN(func()); | ||||
| } | ||||
| 
 | ||||
| template<int func(void *, const char *)> void WrapI_VC() { | ||||
|     u32 param_1 = 0; | ||||
|     u32 retval = func(¶m_1, Memory::GetCharPointer(PARAM(1))); | ||||
|     Core::g_app_core->SetReg(1, param_1); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, void *, int)> void WrapU_IVI() { | ||||
|     u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, int, int, u32)> void WrapI_CIIU() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, const char *, u32, void *, void *, u32, int)> void WrapI_ICUVVUI() { | ||||
|     u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2),  | ||||
|         Memory::GetPointer(PARAM(3)),Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| // Hm, do so many params get passed in registers?
 | ||||
| template<int func(const char *, int, const char *, int, int, int, int, int)> void WrapI_CICIIIII() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), Memory::GetCharPointer(PARAM(2)), | ||||
|         PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| // Hm, do so many params get passed in registers?
 | ||||
| template<int func(const char *, int, int, int, int, int, int)> void WrapI_CIIIIII() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|         PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| // Hm, do so many params get passed in registers?
 | ||||
| template<int func(int, int, int, int, int, int, u32)> void WrapI_IIIIIIU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| // Hm, do so many params get passed in registers?
 | ||||
| template<int func(int, int, int, int, int, int, int, int, u32)> void WrapI_IIIIIIIIU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7), PARAM(8)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, void *)> void WrapU_IV() { | ||||
|     u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<float func()> void WrapF_V() { | ||||
|     RETURNF(func()); | ||||
| } | ||||
| 
 | ||||
| // TODO: Not sure about the floating point parameter passing
 | ||||
| template<float func(int, float, u32)> void WrapF_IFU() { | ||||
|     RETURNF(func(PARAM(0), PARAMF(0), PARAM(1))); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32)> void WrapU_U() { | ||||
|     u32 retval = func(PARAM(0)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int)> void WrapU_UI() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32)> void WrapI_U() { | ||||
|     int retval = func(PARAM(0)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, int)> void WrapI_UI() { | ||||
|     int retval = func(PARAM(0), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, int, int, u32)> void WrapI_UIIU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, u32, int)> void WrapU_IUI() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32)> void WrapI_UU() { | ||||
|     int retval = func(PARAM(0), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, float, float)> void WrapI_UFF() { | ||||
|     // Not sure about the float arguments.
 | ||||
|     int retval = func(PARAM(0), PARAMF(0), PARAMF(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, u32)> void WrapI_UUU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, u32, int)> void WrapI_UUUI() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, u32, int, int, int,int )> void WrapI_UUUIIII() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, u32, u32)> void WrapI_UUUU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, u32, u32, u32)> void WrapI_UUUUU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(void*)> void WrapI_V() { | ||||
|     u32 retval = func(Memory::GetPointer(PARAM(0))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int)> void WrapU_I() { | ||||
|     u32 retval = func(PARAM(0)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, int, u32)> void WrapU_IIU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int)> void WrapI_I() { | ||||
|     int retval = func(PARAM(0)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32)> void WrapV_U() { | ||||
|     func(PARAM(0)); | ||||
| } | ||||
| 
 | ||||
| template<void func(int)> void WrapV_I() { | ||||
|     func(PARAM(0)); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, u32)> void WrapV_UU() { | ||||
|     func(PARAM(0), PARAM(1)); | ||||
| } | ||||
| 
 | ||||
| template<void func(int, int)> void WrapV_II() { | ||||
|     func(PARAM(0), PARAM(1)); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, const char *)> void WrapV_UC() { | ||||
|     func(PARAM(0), Memory::GetCharPointer(PARAM(1))); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, const char *)> void WrapI_UC() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, const char *, int)> void WrapI_UCI() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int , int , int, int, int)> void WrapU_UIIIII() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int , int , int, u32)> void WrapU_UIIIU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int , int , int, int, int, int)> void WrapU_UIIIIII() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32)> void WrapU_UU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, int)> void WrapU_UUI() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, int, int)> void WrapU_UUII() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *, u32, u32, u32)> void WrapU_CUUU() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, int, u32, int, int)> void WrapV_UIUII() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int, u32, int, int)> void WrapU_UIUII() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, int, u32, int, int)> void WrapI_UIUII() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int, u32, int)> void WrapU_UIUI() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, int, u32, int)> void WrapI_UIUI() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int, u32)> void WrapU_UIU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int, u32, u32)> void WrapU_UIUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int, int)> void WrapU_UII() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int, int, u32)> void WrapU_UIIU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, int, int, u32, u32)> void WrapI_UIIUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, int, int)> void WrapI_UUII() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, int, int, int)> void WrapI_UUIII() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, int, int, int)> void WrapV_UIII() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, int, int, int, int, int)> void WrapV_UIIIII() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, int, int)> void WrapV_UII() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2)); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, u32)> void WrapU_IU() { | ||||
|     int retval = func(PARAM(0), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, u32)> void WrapI_IU() { | ||||
|     int retval = func(PARAM(0), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, int)> void WrapI_UUI() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, u32, int, u32)> void WrapI_UUIU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, int)> void WrapI_II() { | ||||
|     int retval = func(PARAM(0), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, int, int)> void WrapI_III() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, u32, int)> void WrapI_IUI() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, int, int, int)> void WrapI_IIII() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, int, int, int)> void WrapI_UIII() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, int, int, u32, int)> void WrapI_IIIUI() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, u32, u32, int, int)> void WrapI_IUUII() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, const char *, int, u32, u32)> void WrapI_ICIUU() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, int, u32)> void WrapI_IIU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| ////////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||
| // Function wrappers that return type s32
 | ||||
| 
 | ||||
| template<void func(int, u32)> void WrapV_IU() { | ||||
|     func(PARAM(0), PARAM(1)); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, int)> void WrapV_UI() { | ||||
|     func(PARAM(0), PARAM(1)); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *)> void WrapU_C() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *, const char *, const char *, u32)> void WrapU_CCCU() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0)), | ||||
|         Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), | ||||
|         PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *)> void WrapI_C() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, u32)> void WrapI_CU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, u32, int)> void WrapI_CUI() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, const char *, int, u32)> void WrapI_ICIU() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, int, u32)> void WrapI_CIU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, u32, u32)> void WrapI_CUU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, u32, u32, u32)> void WrapI_CUUU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|         PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, const char*, int, int)> void WrapI_CCII() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, u32, u32, int, u32, u32)> void WrapI_CUUIUU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|         PARAM(3), PARAM(4), PARAM(5)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, int, int, u32, int, int)> void WrapI_CIIUII() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|         PARAM(3), PARAM(4), PARAM(5)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, int, u32, u32, u32)> void WrapI_CIUUU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|         PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, u32, u32, u32, u32, u32)> void WrapI_CUUUUU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|             PARAM(3), PARAM(4), PARAM(5)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *, u32)> void WrapU_CU() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1)); | ||||
|     RETURN((u32) retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, const char *)> void WrapU_UC() { | ||||
|     u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *, u32, u32)> void WrapU_CUU() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||||
|     RETURN((u32) retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, int, int)> void WrapU_III() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, int)> void WrapU_II() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, int, int, int)> void WrapU_IIII() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, u32, u32)> void WrapU_IUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, u32, u32, u32)> void WrapU_IUUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(int, u32, u32, u32, u32)> void WrapU_IUUUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, u32)> void WrapU_UUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(int, u32, u32)> void WrapV_IUU() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2)); | ||||
| } | ||||
| 
 | ||||
| template<void func(int, int, u32)> void WrapV_IIU() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2)); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, int, u32)> void WrapV_UIU() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2)); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, int, u32)> void WrapI_UIU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(int, u32, u32, u32, u32)> void WrapV_IUUUU() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, u32, u32)> void WrapV_UUU() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2)); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, u32, u32, u32)> void WrapV_UUUU() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
| } | ||||
| 
 | ||||
| template<void func(const char *, u32, int, u32)> void WrapV_CUIU() { | ||||
|     func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3)); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, u32, int, u32)> void WrapI_CUIU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, const char *, u32, int, u32)> void WrapV_UCUIU() { | ||||
|     func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), | ||||
|         PARAM(4)); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, const char *, u32, int, u32)> void WrapI_UCUIU() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), | ||||
|         PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(const char *, u32, int, int, u32)> void WrapV_CUIIU() { | ||||
|     func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3), | ||||
|         PARAM(4)); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, u32, int, int, u32)> void WrapI_CUIIU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|             PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, u32, u32)> void WrapU_UUUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, const char *, u32, u32)> void WrapU_UCUU() { | ||||
|     u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, u32, int)> void WrapU_UUUI() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, u32, int, u32)> void WrapU_UUUIU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, u32, int, u32, int)> void WrapU_UUUIUI() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, int, u32)> void WrapU_UUIU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, int, int, int)> void WrapU_UIII() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, u32, u32, u32, u32)> void WrapI_IUUUU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, u32, u32, u32, u32, u32)> void WrapI_IUUUUU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, u32, int, int)> void WrapI_IUII() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| template<u32 func(u32, u32, u32, u32, u32)> void WrapU_UUUUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(u32, u32, u32, u32, u32)> void WrapV_UUUUU() { | ||||
|     func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *, const char *)> void WrapU_CC() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), | ||||
|             Memory::GetCharPointer(PARAM(1))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<void func(const char*)> void WrapV_C() { | ||||
|     func(Memory::GetCharPointer(PARAM(0))); | ||||
| } | ||||
| 
 | ||||
| template<void func(s64)> void WrapV_S64() { | ||||
|     func(((s64)PARAM(1) << 32) | PARAM(0)); | ||||
| } | ||||
| 
 | ||||
| template<void func(const char *, int)> void WrapV_CI() { | ||||
|     func(Memory::GetCharPointer(PARAM(0)), PARAM(1)); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *, int)> void WrapU_CI() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *, int, int)> void WrapU_CII() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(const char *, int, u32, int, u32)> void WrapU_CIUIU() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|             PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(const char *, int, u32, int, u32, int)> void WrapU_CIUIUI() { | ||||
|     u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), | ||||
|             PARAM(3), PARAM(4), PARAM(5)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, u32, u32, u32, u32)> void WrapU_UUUUUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), | ||||
|             PARAM(5)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, u32, u32, u32)> void WrapI_IUUU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, u32, u32)> void WrapI_IUU() { | ||||
|     int retval = func(PARAM(0), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<u32 func(u32, u32, u32, u32, u32, u32, u32)> void WrapU_UUUUUUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, int, u32, u32)> void WrapI_UIUU() { | ||||
|     u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, const char *)> void WrapI_IC() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template <int func(int, const char *, const char *, u32, int)> void WrapI_ICCUI() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3), PARAM(4)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template <int func(int, const char *, const char *, int)> void WrapI_ICCI() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template <int func(const char *, int, int)> void WrapI_CII() { | ||||
|     int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template <int func(int, const char *, int)> void WrapI_ICI() { | ||||
|     int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, void *, void *, void *, void *, u32, int)> void WrapI_IVVVVUI(){ | ||||
|     u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) ); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(int, const char *, u32, void *, int, int, int)> void WrapI_ICUVIII(){ | ||||
|     u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6)); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(void*, u32)> void WrapI_VU(){ | ||||
|     u32 param_1 = 0; | ||||
|     u32 retval = func(¶m_1, PARAM(1)); | ||||
|     Core::g_app_core->SetReg(1, param_1); | ||||
|     RETURN(retval); | ||||
| } | ||||
| namespace S32 { | ||||
| 
 | ||||
| template<int func(void*, void*, u32)> void WrapI_VVU(){ | ||||
|     u32 retval = func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2)); | ||||
|     RETURN(retval); | ||||
| template<s32 func(u32, u32, u32, u32)> void U32_U32_U32_U32() { | ||||
|     RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3))); | ||||
| } | ||||
| 
 | ||||
| template<int func(void*, u32, void*, int)> void WrapI_VUVI(){ | ||||
|     u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), PARAM(3)); | ||||
|     RETURN(retval); | ||||
| template<s32 func(u32, u32, u32, u32, u32)> void U32_U32_U32_U32_U32() { | ||||
|     RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4))); | ||||
| } | ||||
| 
 | ||||
| template<int func(void*, u32, u32, u32, u32, u32)> void WrapI_VUUUUU(){ | ||||
| template<s32 func(u32*, u32, u32, u32, u32, u32)> void U32P_U32_U32_U32_U32_U32(){ | ||||
|     u32 param_1 = 0; | ||||
|     u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); | ||||
|     Core::g_app_core->SetReg(1, param_1); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(u32, s64)> void WrapI_US64() { | ||||
|     int retval = func(PARAM(0), (((u64)PARAM(3) << 32) | PARAM(2))); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<int func(void*, void*, u32, u32, s64)> void WrapI_VVUUS64() { | ||||
|     u32 param_1 = 0; | ||||
|     int retval = func(¶m_1, Memory::GetPointer(PARAM(1)), PARAM(2), PARAM(3), (((u64)PARAM(4) << 32) | PARAM(0))); | ||||
|     Core::g_app_core->SetReg(1, param_1); | ||||
| template<s32 func(s32*, u32*, s32, bool, s64)> void S32P_U32P_S32_Bool_S64() { | ||||
|     s32 param_1 = 0; | ||||
|     s32 retval = func(¶m_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2),  | ||||
|         (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))); | ||||
|     Core::g_app_core->SetReg(1, (u32)param_1); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| // TODO(bunnei): Is this correct? Probably not
 | ||||
| template<int func(u32, u32, u32, u32, s64)> void WrapI_UUUUS64() { | ||||
|     int retval = func(PARAM(5), PARAM(1), PARAM(2), PARAM(3), (((u64)PARAM(4) << 32) | PARAM(0))); | ||||
| template<s32 func(u32, u32, u32, u32, s64)> void U32_U32_U32_U32_S64() { | ||||
|     RETURN(func(PARAM(5), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(4) << 32) | PARAM(0)))); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(u32, s64)> void U32_S64() { | ||||
|     RETURN(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2)))); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(void*, void*, u32)> void VoidP_VoidP_U32(){ | ||||
|     RETURN(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2))); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(s32*, u32)> void S32P_U32(){ | ||||
|     s32 param_1 = 0; | ||||
|     u32 retval = func(¶m_1, PARAM(1)); | ||||
|     Core::g_app_core->SetReg(1, param_1); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(u32, s32)> void U32_S32() { | ||||
|     RETURN(func(PARAM(0), (s32)PARAM(1))); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(u32*, u32)> void U32P_U32(){ | ||||
|     u32 param_1 = 0; | ||||
|     u32 retval = func(¶m_1, PARAM(1)); | ||||
|     Core::g_app_core->SetReg(1, param_1); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(u32)> void U32() { | ||||
|     RETURN(func(PARAM(0))); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(void*)> void U32P() { | ||||
|     RETURN(func(Memory::GetPointer(PARAM(0)))); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(s64*, u32, void*, s32)> void S64P_U32_VoidP_S32(){ | ||||
|     RETURN(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)),  | ||||
|         (s32)PARAM(3))); | ||||
| } | ||||
| 
 | ||||
| template<s32 func(u32*, const char*)> void U32P_CharP() { | ||||
|     u32 param_1 = 0; | ||||
|     u32 retval = func(¶m_1, Memory::GetCharPointer(PARAM(1))); | ||||
|     Core::g_app_core->SetReg(1, param_1); | ||||
|     RETURN(retval); | ||||
| } | ||||
| 
 | ||||
| } // namespace S32
 | ||||
| 
 | ||||
| ////////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||
| // Function wrappers that return type u32
 | ||||
| 
 | ||||
| namespace U32 { | ||||
| 
 | ||||
| template<u32 func()> void Void() { | ||||
|     RETURN(func()); | ||||
| } | ||||
| 
 | ||||
| } // namespace U32
 | ||||
| 
 | ||||
| ////////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||
| /// Function wrappers that return type void
 | ||||
| 
 | ||||
| namespace Void { | ||||
| 
 | ||||
| template<void func(s64)> void S64() { | ||||
|     func(((s64)PARAM(1) << 32) | PARAM(0)); | ||||
| } | ||||
| 
 | ||||
| template<void func(const char*)> void CharP() { | ||||
|     func(Memory::GetCharPointer(PARAM(0))); | ||||
| } | ||||
| 
 | ||||
| } // namespace Void
 | ||||
| 
 | ||||
| } // namespace Wrap
 | ||||
|  |  | |||
|  | @ -34,9 +34,7 @@ enum MapMemoryPermission { | |||
| }; | ||||
| 
 | ||||
| /// Map application or GSP heap memory
 | ||||
| Result ControlMemory(void* _out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { | ||||
|     u32* out_addr = (u32*)_out_addr; | ||||
| 
 | ||||
| Result ControlMemory(u32* out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { | ||||
|     DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X",  | ||||
|         operation, addr0, addr1, size, permissions); | ||||
| 
 | ||||
|  | @ -76,8 +74,7 @@ Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherper | |||
| } | ||||
| 
 | ||||
| /// Connect to an OS service given the port name, returns the handle to the port to out
 | ||||
| Result ConnectToPort(void* _out, const char* port_name) { | ||||
|     Handle* out = (Handle*)_out; | ||||
| Result ConnectToPort(Handle* out, const char* port_name) { | ||||
|     Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); | ||||
| 
 | ||||
|     DEBUG_LOG(SVC, "called port_name=%s", port_name); | ||||
|  | @ -136,11 +133,9 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) { | |||
| } | ||||
| 
 | ||||
| /// Wait for the given handles to synchronize, timeout after the specified nanoseconds
 | ||||
| Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wait_all,  | ||||
| Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all,  | ||||
|     s64 nano_seconds) { | ||||
|     // TODO(bunnei): Do something with nano_seconds, currently ignoring this
 | ||||
|     s32* out = (s32*)_out; | ||||
|     Handle* handles = (Handle*)_handles; | ||||
|     bool unlock_all = true; | ||||
|     bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated
 | ||||
| 
 | ||||
|  | @ -148,7 +143,7 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa | |||
|         handle_count, (wait_all ? "true" : "false"), nano_seconds); | ||||
| 
 | ||||
|     // Iterate through each handle, synchronize kernel object
 | ||||
|     for (u32 i = 0; i < handle_count; i++) { | ||||
|     for (s32 i = 0; i < handle_count; i++) { | ||||
|         bool wait = false; | ||||
|         Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]); | ||||
| 
 | ||||
|  | @ -200,18 +195,17 @@ void OutputDebugString(const char* string) { | |||
| } | ||||
| 
 | ||||
| /// Get resource limit
 | ||||
| Result GetResourceLimit(void* _resource_limit, Handle process) { | ||||
| Result GetResourceLimit(Handle* resource_limit, Handle process) { | ||||
|     // With regards to proceess values:
 | ||||
|     // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for 
 | ||||
|     // the current KThread.
 | ||||
|     Handle* resource_limit = (Handle*)_resource_limit; | ||||
|     *resource_limit = 0xDEADBEEF; | ||||
|     ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| /// Get resource limit current values
 | ||||
| Result GetResourceLimitCurrentValues(void* _values, Handle resource_limit, void* names,  | ||||
| Result GetResourceLimitCurrentValues(s64* values, Handle resource_limit, void* names,  | ||||
|     s32 name_count) { | ||||
|     ERROR_LOG(SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d", | ||||
|         resource_limit, names, name_count); | ||||
|  | @ -255,8 +249,7 @@ u32 ExitThread() { | |||
| } | ||||
| 
 | ||||
| /// Gets the priority for the specified thread
 | ||||
| Result GetThreadPriority(void* _priority, Handle handle) { | ||||
|     s32* priority = (s32*)_priority; | ||||
| Result GetThreadPriority(s32* priority, Handle handle) { | ||||
|     *priority = Kernel::GetThreadPriority(handle); | ||||
|     return 0; | ||||
| } | ||||
|  | @ -267,8 +260,7 @@ Result SetThreadPriority(Handle handle, s32 priority) { | |||
| } | ||||
| 
 | ||||
| /// Create a mutex
 | ||||
| Result CreateMutex(void* _mutex, u32 initial_locked) { | ||||
|     Handle* mutex = (Handle*)_mutex; | ||||
| Result CreateMutex(Handle* mutex, u32 initial_locked) { | ||||
|     *mutex = Kernel::CreateMutex((initial_locked != 0)); | ||||
|     DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X",  | ||||
|         initial_locked ? "true" : "false", *mutex); | ||||
|  | @ -284,20 +276,19 @@ Result ReleaseMutex(Handle handle) { | |||
| } | ||||
| 
 | ||||
| /// Get current thread ID
 | ||||
| Result GetThreadId(void* thread_id, u32 thread) { | ||||
| Result GetThreadId(u32* thread_id, Handle thread) { | ||||
|     ERROR_LOG(SVC, "(UNIMPLEMENTED) called thread=0x%08X", thread); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| /// Query memory
 | ||||
| Result QueryMemory(void *_info, void *_out, u32 addr) { | ||||
| Result QueryMemory(void* info, void* out, u32 addr) { | ||||
|     ERROR_LOG(SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| /// Create an event
 | ||||
| Result CreateEvent(void* _event, u32 reset_type) { | ||||
|     Handle* evt = (Handle*)_event; | ||||
| Result CreateEvent(Handle* evt, u32 reset_type) { | ||||
|     *evt = Kernel::CreateEvent((ResetType)reset_type); | ||||
|     DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X",  | ||||
|         reset_type, *evt); | ||||
|  | @ -305,8 +296,7 @@ Result CreateEvent(void* _event, u32 reset_type) { | |||
| } | ||||
| 
 | ||||
| /// Duplicates a kernel handle
 | ||||
| Result DuplicateHandle(void* _out, Handle handle) { | ||||
|     Handle* out = (Handle*)_out; | ||||
| Result DuplicateHandle(Handle* out, Handle handle) { | ||||
|     DEBUG_LOG(SVC, "called handle=0x%08X", handle); | ||||
| 
 | ||||
|     // Translate kernel handles -> real handles
 | ||||
|  | @ -343,67 +333,67 @@ void SleepThread(s64 nanoseconds) { | |||
| 
 | ||||
| const HLE::FunctionDef SVC_Table[] = { | ||||
|     {0x00,  nullptr,                                                 "Unknown"}, | ||||
|     {0x01,  WrapI_VUUUUU<ControlMemory>,                "ControlMemory"}, | ||||
|     {0x02,  WrapI_VVU<QueryMemory>,                     "QueryMemory"}, | ||||
|     {0x01,  Wrap::S32::U32P_U32_U32_U32_U32_U32<ControlMemory>,      "ControlMemory"}, | ||||
|     {0x02,  Wrap::S32::VoidP_VoidP_U32<QueryMemory>,                 "QueryMemory"}, | ||||
|     {0x03,  nullptr,                                                 "ExitProcess"}, | ||||
|     {0x04,  nullptr,                                                 "GetProcessAffinityMask"}, | ||||
|     {0x05,  nullptr,                                                 "SetProcessAffinityMask"}, | ||||
|     {0x06,  nullptr,                                                 "GetProcessIdealProcessor"}, | ||||
|     {0x07,  nullptr,                                                 "SetProcessIdealProcessor"}, | ||||
|     {0x08,  WrapI_UUUUU<CreateThread>,                  "CreateThread"}, | ||||
|     {0x09,  WrapU_V<ExitThread>,                        "ExitThread"}, | ||||
|     {0x0A,  WrapV_S64<SleepThread>,                     "SleepThread"}, | ||||
|     {0x0B,  WrapI_VU<GetThreadPriority>,                "GetThreadPriority"}, | ||||
|     {0x0C,  WrapI_UI<SetThreadPriority>,                "SetThreadPriority"}, | ||||
|     {0x08,  Wrap::S32::U32_U32_U32_U32_U32<CreateThread>,            "CreateThread"}, | ||||
|     {0x09,  Wrap::U32::Void<ExitThread>,                             "ExitThread"}, | ||||
|     {0x0A,  Wrap::Void::S64<SleepThread>,                            "SleepThread"}, | ||||
|     {0x0B,  Wrap::S32::S32P_U32<GetThreadPriority>,                  "GetThreadPriority"}, | ||||
|     {0x0C,  Wrap::S32::U32_S32<SetThreadPriority>,                   "SetThreadPriority"}, | ||||
|     {0x0D,  nullptr,                                                 "GetThreadAffinityMask"}, | ||||
|     {0x0E,  nullptr,                                                 "SetThreadAffinityMask"}, | ||||
|     {0x0F,  nullptr,                                                 "GetThreadIdealProcessor"}, | ||||
|     {0x10,  nullptr,                                                 "SetThreadIdealProcessor"}, | ||||
|     {0x11,  nullptr,                                                 "GetCurrentProcessorNumber"}, | ||||
|     {0x12,  nullptr,                                                 "Run"}, | ||||
|     {0x13,  WrapI_VU<CreateMutex>,                      "CreateMutex"}, | ||||
|     {0x14,  WrapI_U<ReleaseMutex>,                      "ReleaseMutex"}, | ||||
|     {0x13,  Wrap::S32::U32P_U32<CreateMutex>,                        "CreateMutex"}, | ||||
|     {0x14,  Wrap::S32::U32<ReleaseMutex>,                            "ReleaseMutex"}, | ||||
|     {0x15,  nullptr,                                                 "CreateSemaphore"}, | ||||
|     {0x16,  nullptr,                                                 "ReleaseSemaphore"}, | ||||
|     {0x17,  WrapI_VU<CreateEvent>,                      "CreateEvent"}, | ||||
|     {0x18,  WrapI_U<SignalEvent>,                       "SignalEvent"}, | ||||
|     {0x19,  WrapI_U<ClearEvent>,                        "ClearEvent"}, | ||||
|     {0x17,  Wrap::S32::U32P_U32<CreateEvent>,                        "CreateEvent"}, | ||||
|     {0x18,  Wrap::S32::U32<SignalEvent>,                             "SignalEvent"}, | ||||
|     {0x19,  Wrap::S32::U32<ClearEvent>,                              "ClearEvent"}, | ||||
|     {0x1A,  nullptr,                                                 "CreateTimer"}, | ||||
|     {0x1B,  nullptr,                                                 "SetTimer"}, | ||||
|     {0x1C,  nullptr,                                                 "CancelTimer"}, | ||||
|     {0x1D,  nullptr,                                                 "ClearTimer"}, | ||||
|     {0x1E,  nullptr,                                                 "CreateMemoryBlock"}, | ||||
|     {0x1F,  WrapI_UUUU<MapMemoryBlock>,                 "MapMemoryBlock"}, | ||||
|     {0x1F,  Wrap::S32::U32_U32_U32_U32<MapMemoryBlock>,              "MapMemoryBlock"}, | ||||
|     {0x20,  nullptr,                                                 "UnmapMemoryBlock"}, | ||||
|     {0x21,  WrapI_V<CreateAddressArbiter>,              "CreateAddressArbiter"}, | ||||
|     {0x22,  WrapI_UUUUS64<ArbitrateAddress>,            "ArbitrateAddress"}, | ||||
|     {0x23,  WrapI_U<CloseHandle>,                       "CloseHandle"}, | ||||
|     {0x24,  WrapI_US64<WaitSynchronization1>,           "WaitSynchronization1"}, | ||||
|     {0x25,  WrapI_VVUUS64<WaitSynchronizationN>,        "WaitSynchronizationN"}, | ||||
|     {0x21,  Wrap::S32::U32P<CreateAddressArbiter>,                   "CreateAddressArbiter"}, | ||||
|     {0x22,  Wrap::S32::U32_U32_U32_U32_S64<ArbitrateAddress>,        "ArbitrateAddress"}, | ||||
|     {0x23,  Wrap::S32::U32<CloseHandle>,                             "CloseHandle"}, | ||||
|     {0x24,  Wrap::S32::U32_S64<WaitSynchronization1>,                "WaitSynchronization1"}, | ||||
|     {0x25,  Wrap::S32::S32P_U32P_S32_Bool_S64<WaitSynchronizationN>, "WaitSynchronizationN"}, | ||||
|     {0x26,  nullptr,                                                 "SignalAndWait"}, | ||||
|     {0x27,  WrapI_VU<DuplicateHandle>,                  "DuplicateHandle"}, | ||||
|     {0x27,  Wrap::S32::U32P_U32<DuplicateHandle>,                    "DuplicateHandle"}, | ||||
|     {0x28,  nullptr,                                                 "GetSystemTick"}, | ||||
|     {0x29,  nullptr,                                                 "GetHandleInfo"}, | ||||
|     {0x2A,  nullptr,                                                 "GetSystemInfo"}, | ||||
|     {0x2B,  nullptr,                                                 "GetProcessInfo"}, | ||||
|     {0x2C,  nullptr,                                                 "GetThreadInfo"}, | ||||
|     {0x2D,  WrapI_VC<ConnectToPort>,                    "ConnectToPort"}, | ||||
|     {0x2D,  Wrap::S32::U32P_CharP<ConnectToPort>,                    "ConnectToPort"}, | ||||
|     {0x2E,  nullptr,                                                 "SendSyncRequest1"}, | ||||
|     {0x2F,  nullptr,                                                 "SendSyncRequest2"}, | ||||
|     {0x30,  nullptr,                                                 "SendSyncRequest3"}, | ||||
|     {0x31,  nullptr,                                                 "SendSyncRequest4"}, | ||||
|     {0x32,  WrapI_U<SendSyncRequest>,                   "SendSyncRequest"}, | ||||
|     {0x32,  Wrap::S32::U32<SendSyncRequest>,                         "SendSyncRequest"}, | ||||
|     {0x33,  nullptr,                                                 "OpenProcess"}, | ||||
|     {0x34,  nullptr,                                                 "OpenThread"}, | ||||
|     {0x35,  nullptr,                                                 "GetProcessId"}, | ||||
|     {0x36,  nullptr,                                                 "GetProcessIdOfThread"}, | ||||
|     {0x37,  WrapI_VU<GetThreadId>,                      "GetThreadId"}, | ||||
|     {0x38,  WrapI_VU<GetResourceLimit>,                 "GetResourceLimit"}, | ||||
|     {0x37,  Wrap::S32::U32P_U32<GetThreadId>,                        "GetThreadId"}, | ||||
|     {0x38,  Wrap::S32::U32P_U32<GetResourceLimit>,                   "GetResourceLimit"}, | ||||
|     {0x39,  nullptr,                                                 "GetResourceLimitLimitValues"}, | ||||
|     {0x3A,  WrapI_VUVI<GetResourceLimitCurrentValues>,  "GetResourceLimitCurrentValues"}, | ||||
|     {0x3A,  Wrap::S32::S64P_U32_VoidP_S32<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"}, | ||||
|     {0x3B,  nullptr,                              "GetThreadContext"}, | ||||
|     {0x3C,  nullptr,                              "Break"}, | ||||
|     {0x3D,  WrapV_C<OutputDebugString>,                 "OutputDebugString"}, | ||||
|     {0x3D,  Wrap::Void::CharP<OutputDebugString>, "OutputDebugString"}, | ||||
|     {0x3E,  nullptr,                              "ControlPerformanceCounter"}, | ||||
|     {0x3F,  nullptr,                              "Unknown"}, | ||||
|     {0x40,  nullptr,                              "Unknown"}, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue