Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdint.h>
- typedef struct
- {
- uint8_t cmd;
- union
- {
- unsigned ext:24;
- struct
- {
- uint8_t count;
- uint16_t __unused_00;
- };
- }
- union
- {
- uint32_t word;
- struct
- {
- uint8_t bank;
- unsigned offset:24;
- };
- };
- }
- map_header_cmd;
- void*
- seg_to_ram( int seg )
- {
- void *seg_table = 0x80166FA8;
- if(seg == 0x80)
- return 0x80000000;
- seg &= 0xF;
- if(seg_table[seg])
- return seg_table[seg] | 0x80000000;
- return 0;
- }
- void
- set_segment( int seg_n, void *ptr )
- {
- uint32_t **dl_ptr;
- dl_ptr = (uint32_t*)(*(uint32_t*)(z_ctxt) + 0x2D0);
- **(*dl_ptr++) = 0xDB060000 | (seg_n * 4);
- **(*dl_ptr++) = (uint32_t)ptr;
- **(*dl_ptr++) = 0xE7000000;
- **(*dl_ptr++) = 0x00000000;
- }
- void
- texture_bytecode(void *z_ctxt)
- {
- map_header_cmd *map_ptr;
- void *(tex_func)( void *z_ctxt );
- for(
- map_ptr = (uint32_t*)(*(uint32_t*)(z_ctxt + 0x11CC8));
- map_ptr->cmd != 0x14;
- map_ptr++
- {
- if(map_ptr->cmd == 0xA
- && map_ptr->ext
- && map_ptr->bank)
- goto do_texture;
- }
- return;
- do_texture:
- tex_func = (void*)(map_ptr->ext + seg_to_ram(map_ptr->bank));
- tex_func( z_ctxt );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement