mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	MemMap: Added a WriteBlock function to write a buffer of data to memory.
This commit is contained in:
		
							parent
							
								
									cedc28dcc6
								
							
						
					
					
						commit
						6aebd4ac98
					
				
					 2 changed files with 14 additions and 0 deletions
				
			
		|  | @ -139,6 +139,8 @@ void Write8(const u32 addr, const u8 data); | ||||||
| void Write16(const u32 addr, const u16 data); | void Write16(const u32 addr, const u16 data); | ||||||
| void Write32(const u32 addr, const u32 data); | void Write32(const u32 addr, const u32 data); | ||||||
| 
 | 
 | ||||||
|  | void WriteBlock(const u32 addr, const u8* data, const int size); | ||||||
|  | 
 | ||||||
| u8* GetPointer(const u32 Address); | u8* GetPointer(const u32 Address); | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  |  | ||||||
|  | @ -293,4 +293,16 @@ void Write64(const u32 addr, const u64 data) { | ||||||
|     _Write<u64_le>(addr, data); |     _Write<u64_le>(addr, data); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void WriteBlock(const u32 addr, const u8* data, const int size) { | ||||||
|  |     int offset = 0; | ||||||
|  |     while (offset < (size & ~3)) | ||||||
|  |         Write32(addr + offset, *(u32*)&data[offset += 4]); | ||||||
|  | 
 | ||||||
|  |     if (size & 2) | ||||||
|  |         Write16(addr + offset, *(u16*)&data[offset += 2]); | ||||||
|  | 
 | ||||||
|  |     if (size & 1) | ||||||
|  |         Write8(addr + offset, data[offset]); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| } // namespace
 | } // namespace
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue