mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Apply suggestions from code review
Co-Authored-By: Mat M. <mathew1800@gmail.com>
This commit is contained in:
		
							parent
							
								
									841255cd16
								
							
						
					
					
						commit
						8f059ae398
					
				
					 9 changed files with 23 additions and 22 deletions
				
			
		|  | @ -4,7 +4,7 @@ | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include "boost/archive/binary_iarchive.hpp" | #include <boost/archive/binary_iarchive.hpp> | ||||||
| #include "boost/archive/binary_oarchive.hpp" | #include "boost/archive/binary_oarchive.hpp" | ||||||
| #include "boost/serialization/export.hpp" | #include "boost/serialization/export.hpp" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ private: | ||||||
| class BufferMem : public BackingMem { | class BufferMem : public BackingMem { | ||||||
| public: | public: | ||||||
|     BufferMem() = default; |     BufferMem() = default; | ||||||
|     BufferMem(u32 size) : data(std::vector<u8>(size)) {} |     explicit BufferMem(std::size_t size) : data(size) {} | ||||||
| 
 | 
 | ||||||
|     u8* GetPtr() override { |     u8* GetPtr() override { | ||||||
|         return data.data(); |         return data.data(); | ||||||
|  | @ -77,7 +77,7 @@ public: | ||||||
|     inline u8* GetPtr() { |     inline u8* GetPtr() { | ||||||
|         return cptr; |         return cptr; | ||||||
|     } |     } | ||||||
|     inline operator bool() const { |     explicit operator bool() const { | ||||||
|         return cptr != nullptr; |         return cptr != nullptr; | ||||||
|     } |     } | ||||||
|     inline const u8* GetPtr() const { |     inline const u8* GetPtr() const { | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ void load(Archive& ar, boost::container::flat_set<T>& set, const unsigned int fi | ||||||
|     u64 count{}; |     u64 count{}; | ||||||
|     ar >> count; |     ar >> count; | ||||||
|     set.clear(); |     set.clear(); | ||||||
|     for (auto i = 0; i < count; i++) { |     for (u64 i = 0; i < count; i++) { | ||||||
|         T value{}; |         T value{}; | ||||||
|         ar >> value; |         ar >> value; | ||||||
|         set.insert(value); |         set.insert(value); | ||||||
|  |  | ||||||
|  | @ -167,7 +167,7 @@ private: | ||||||
|         } else if (q == UnlinkedTag()) { |         } else if (q == UnlinkedTag()) { | ||||||
|             return -1; |             return -1; | ||||||
|         } else { |         } else { | ||||||
|             return static_cast<s32>(q - &queues[0]); |             return q - queues.data(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -186,8 +186,8 @@ private: | ||||||
|     void save(Archive& ar, const unsigned int file_version) const { |     void save(Archive& ar, const unsigned int file_version) const { | ||||||
|         s32 idx = ToIndex(first); |         s32 idx = ToIndex(first); | ||||||
|         ar << idx; |         ar << idx; | ||||||
|         for (auto i = 0; i < NUM_QUEUES; i++) { |         for (size_t i = 0; i < NUM_QUEUES; i++) { | ||||||
|             s32 idx1 = ToIndex(queues[i].next_nonempty); |             const s32 idx1 = ToIndex(queues[i].next_nonempty); | ||||||
|             ar << idx1; |             ar << idx1; | ||||||
|             ar << queues[i].data; |             ar << queues[i].data; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -28,12 +28,12 @@ public: | ||||||
| 
 | 
 | ||||||
|         template <class Archive> |         template <class Archive> | ||||||
|         void save(Archive& ar, const unsigned int file_version) const { |         void save(Archive& ar, const unsigned int file_version) const { | ||||||
|             for (auto i = 0; i < 16; i++) { |             for (size_t i = 0; i < 16; i++) { | ||||||
|                 auto r = GetCpuRegister(i); |                 const auto r = GetCpuRegister(i); | ||||||
|                 ar << r; |                 ar << r; | ||||||
|             } |             } | ||||||
|             for (auto i = 0; i < 16; i++) { |             for (size_t i = 0; i < 16; i++) { | ||||||
|                 auto r = GetFpuRegister(i); |                 const auto r = GetFpuRegister(i); | ||||||
|                 ar << r; |                 ar << r; | ||||||
|             } |             } | ||||||
|             auto r1 = GetCpsr(); |             auto r1 = GetCpsr(); | ||||||
|  | @ -47,11 +47,11 @@ public: | ||||||
|         template <class Archive> |         template <class Archive> | ||||||
|         void load(Archive& ar, const unsigned int file_version) { |         void load(Archive& ar, const unsigned int file_version) { | ||||||
|             u32 r; |             u32 r; | ||||||
|             for (auto i = 0; i < 16; i++) { |             for (size_t i = 0; i < 16; i++) { | ||||||
|                 ar >> r; |                 ar >> r; | ||||||
|                 SetCpuRegister(i, r); |                 SetCpuRegister(i, r); | ||||||
|             } |             } | ||||||
|             for (auto i = 0; i < 16; i++) { |             for (size_t i = 0; i < 16; i++) { | ||||||
|                 ar >> r; |                 ar >> r; | ||||||
|                 SetFpuRegister(i, r); |                 SetFpuRegister(i, r); | ||||||
|             } |             } | ||||||
|  | @ -247,7 +247,7 @@ private: | ||||||
|         ar << id; |         ar << id; | ||||||
|         auto page_table = GetPageTable(); |         auto page_table = GetPageTable(); | ||||||
|         ar << page_table; |         ar << page_table; | ||||||
|         for (auto i = 0; i < 15; i++) { |         for (size_t i = 0; i < 15; i++) { | ||||||
|             auto r = GetReg(i); |             auto r = GetReg(i); | ||||||
|             ar << r; |             ar << r; | ||||||
|         } |         } | ||||||
|  | @ -255,7 +255,7 @@ private: | ||||||
|         ar << pc; |         ar << pc; | ||||||
|         auto cpsr = GetCPSR(); |         auto cpsr = GetCPSR(); | ||||||
|         ar << cpsr; |         ar << cpsr; | ||||||
|         for (auto i = 0; i < 32; i++) { |         for (size_t i = 0; i < 32; i++) { | ||||||
|             auto r = GetVFPReg(i); |             auto r = GetVFPReg(i); | ||||||
|             ar << r; |             ar << r; | ||||||
|         } |         } | ||||||
|  | @ -278,7 +278,7 @@ private: | ||||||
|         ar >> page_table; |         ar >> page_table; | ||||||
|         SetPageTable(page_table); |         SetPageTable(page_table); | ||||||
|         u32 r; |         u32 r; | ||||||
|         for (auto i = 0; i < 15; i++) { |         for (size_t = 0; i < 15; i++) { | ||||||
|             ar >> r; |             ar >> r; | ||||||
|             SetReg(i, r); |             SetReg(i, r); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -58,7 +58,7 @@ public: | ||||||
|     ConfigMemDef& GetConfigMem(); |     ConfigMemDef& GetConfigMem(); | ||||||
| 
 | 
 | ||||||
|     u8* GetPtr() override { |     u8* GetPtr() override { | ||||||
|         return static_cast<u8*>(static_cast<void*>(&config_mem)); |         return reinterpret_cast<u8*>(&config_mem)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     u32 GetSize() const override { |     u32 GetSize() const override { | ||||||
|  |  | ||||||
|  | @ -21,7 +21,7 @@ class HLERequestContext::ThreadCallback : public Kernel::WakeupCallback { | ||||||
| public: | public: | ||||||
|     ThreadCallback(std::shared_ptr<HLERequestContext> context_, |     ThreadCallback(std::shared_ptr<HLERequestContext> context_, | ||||||
|                    std::shared_ptr<HLERequestContext::WakeupCallback> callback_) |                    std::shared_ptr<HLERequestContext::WakeupCallback> callback_) | ||||||
|         : context(context_), callback(callback_) {} |         : context(std::move(context_)), callback(std::move(callback_)) {} | ||||||
|     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||||||
|                 std::shared_ptr<WaitObject> object) { |                 std::shared_ptr<WaitObject> object) { | ||||||
|         ASSERT(thread->status == ThreadStatus::WaitHleEvent); |         ASSERT(thread->status == ThreadStatus::WaitHleEvent); | ||||||
|  | @ -296,7 +296,7 @@ MappedBuffer::MappedBuffer() : memory(&Core::Global<Core::System>().Memory()) {} | ||||||
| 
 | 
 | ||||||
| MappedBuffer::MappedBuffer(Memory::MemorySystem& memory, std::shared_ptr<Process> process, | MappedBuffer::MappedBuffer(Memory::MemorySystem& memory, std::shared_ptr<Process> process, | ||||||
|                            u32 descriptor, VAddr address, u32 id) |                            u32 descriptor, VAddr address, u32 id) | ||||||
|     : memory(&memory), id(id), address(address), process(process) { |     : memory(&memory), id(id), address(address), process(std::move(process)) { | ||||||
|     IPC::MappedBufferDescInfo desc{descriptor}; |     IPC::MappedBufferDescInfo desc{descriptor}; | ||||||
|     size = desc.size; |     size = desc.size; | ||||||
|     perms = desc.perms; |     perms = desc.perms; | ||||||
|  |  | ||||||
|  | @ -24,7 +24,8 @@ KernelSystem::KernelSystem(Memory::MemorySystem& memory, Core::Timing& timing, | ||||||
|                            u32 num_cores, u8 n3ds_mode) |                            u32 num_cores, u8 n3ds_mode) | ||||||
|     : memory(memory), timing(timing), |     : memory(memory), timing(timing), | ||||||
|       prepare_reschedule_callback(std::move(prepare_reschedule_callback)) { |       prepare_reschedule_callback(std::move(prepare_reschedule_callback)) { | ||||||
|     for (auto i = 0; i < memory_regions.size(); i++) { | std::generate(memory_regions.begin(), memory_regions.end(), | ||||||
|  |               [] { return std::make_shared<MemoryRegionInfo>(); }); | ||||||
|         memory_regions[i] = std::make_shared<MemoryRegionInfo>(); |         memory_regions[i] = std::make_shared<MemoryRegionInfo>(); | ||||||
|     } |     } | ||||||
|     MemoryInit(system_mode, n3ds_mode); |     MemoryInit(system_mode, n3ds_mode); | ||||||
|  |  | ||||||
|  | @ -409,7 +409,7 @@ static ResultCode ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::Memory | ||||||
| 
 | 
 | ||||||
| class SVC_SyncCallback : public Kernel::WakeupCallback { | class SVC_SyncCallback : public Kernel::WakeupCallback { | ||||||
| public: | public: | ||||||
|     SVC_SyncCallback(bool do_output_) : do_output(do_output_) {} |     explicit SVC_SyncCallback(bool do_output_) : do_output(do_output_) {} | ||||||
|     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||||||
|                 std::shared_ptr<WaitObject> object) { |                 std::shared_ptr<WaitObject> object) { | ||||||
| 
 | 
 | ||||||
|  | @ -442,7 +442,7 @@ private: | ||||||
| 
 | 
 | ||||||
| class SVC_IPCCallback : public Kernel::WakeupCallback { | class SVC_IPCCallback : public Kernel::WakeupCallback { | ||||||
| public: | public: | ||||||
|     SVC_IPCCallback(Core::System& system_) : system(system_) {} |     explicit SVC_IPCCallback(Core::System& system_) : system(system_) {} | ||||||
| 
 | 
 | ||||||
|     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||||||
|                 std::shared_ptr<WaitObject> object) { |                 std::shared_ptr<WaitObject> object) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue