MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / GBIMicrocode_DetectVersionString

Function GBIMicrocode_DetectVersionString

Source/HLEGraphics/Microcode.cpp:61–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59static UcodeInfo gUcodeInfo[ MAX_UCODE_CACHE_ENTRIES ];
60
61static bool GBIMicrocode_DetectVersionString( u32 data_base, u32 data_size, char * str, u32 str_len )
62{
63 #ifdef DAEDALUS_ENABLE_ASSERTS
64 DAEDALUS_ASSERT( data_base < MAX_RAM_ADDRESS + 0x1000 ,"GBIMicrocode out of bound %08X", data_base );
65 #endif
66 const s8 * ram( g_ps8RamBase );
67
68 for ( u32 i {}; i+2 < data_size; i++ )
69 {
70 if ( ram[ (data_base + i+0) ^ 3 ] == 'R' &&
71 ram[ (data_base + i+1) ^ 3 ] == 'S' &&
72 ram[ (data_base + i+2) ^ 3 ] == 'P' )
73 {
74 char * p {str};
75 char * e {str+str_len};
76
77 // Loop while we haven't filled our buffer, and there's space for our terminator
78 while (p+1 < e)
79 {
80 char c( ram[ (data_base + i) ^ U8_TWIDDLE ] );
81 if( c < ' ')
82 break;
83
84 *p++ = c;
85 ++i;
86 }
87 *p++ = 0;
88 return true;
89 }
90 }
91 return false;
92}
93
94static u32 GBIMicrocode_MicrocodeHash(u32 code_base, u32 code_size)
95{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected