diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-07-30 00:53:31 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-07-30 00:53:31 +0200 |
| commit | 073a859acf16ccbc0f49364e38126bf2bf03aa3d (patch) | |
| tree | 90fac6072c5fe3ccee0505c881f89aa262d4eed7 /libpsn00b/psxcd | |
| parent | 0e755e9801a2dcf7b9827c90cc38e9f532d06393 (diff) | |
| download | psn00bsdk-073a859acf16ccbc0f49364e38126bf2bf03aa3d.tar.gz | |
Deprecate u_short, u_int and u_long types in libpsn00b
Diffstat (limited to 'libpsn00b/psxcd')
| -rw-r--r-- | libpsn00b/psxcd/isofs.c | 40 | ||||
| -rw-r--r-- | libpsn00b/psxcd/psxcd.c | 38 |
2 files changed, 39 insertions, 39 deletions
diff --git a/libpsn00b/psxcd/isofs.c b/libpsn00b/psxcd/isofs.c index d1c1b18..582b8d9 100644 --- a/libpsn00b/psxcd/isofs.c +++ b/libpsn00b/psxcd/isofs.c @@ -1,4 +1,4 @@ -#include <sys/types.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -15,18 +15,18 @@ typedef struct _CdlDIR_INT { - u_long _pos; - u_long _len; - u_char* _dir; + uint32_t _pos; + uint32_t _len; + uint8_t *_dir; } CdlDIR_INT; extern int _cd_media_changed; static int _cd_iso_last_dir_lba; -static u_char _cd_iso_descriptor_buff[2048]; -static u_char* _cd_iso_pathtable_buff=NULL; -static u_char* _cd_iso_directory_buff=NULL; +static uint8_t _cd_iso_descriptor_buff[2048]; +static uint8_t *_cd_iso_pathtable_buff=NULL; +static uint8_t *_cd_iso_directory_buff=NULL; static int _cd_iso_directory_len; static int _cd_iso_error=0; @@ -68,7 +68,7 @@ static int _CdReadIsoDescriptor(int session_offs) // Seek to volume descriptor CdIntToPos(16+session_offs, &loc); - if( !CdControl(CdlSetloc, (u_char*)&loc, 0) ) + if( !CdControl(CdlSetloc, (uint8_t*)&loc, 0) ) { #ifdef DEBUG printf("psxcd: Could not set seek destination.\n"); @@ -85,7 +85,7 @@ static int _CdReadIsoDescriptor(int session_offs) printf("psxcd: Read sectors.\n"); #endif // Read volume descriptor - CdRead(1, (u_long*)_cd_iso_descriptor_buff, CdlModeSpeed); + CdRead(1, (uint32_t*)_cd_iso_descriptor_buff, CdlModeSpeed); if( CdReadSync(0, 0) ) { @@ -122,7 +122,7 @@ static int _CdReadIsoDescriptor(int session_offs) { free(_cd_iso_pathtable_buff); } - _cd_iso_pathtable_buff = (u_char*)malloc(i); + _cd_iso_pathtable_buff = (uint8_t*)malloc(i); #ifdef DEBUG printf("psxcd_dbg: Allocated %d bytes for path table.\n", i); @@ -130,8 +130,8 @@ static int _CdReadIsoDescriptor(int session_offs) // Read path table CdIntToPos(descriptor->pathTable1Offs, &loc); - CdControl(CdlSetloc, (u_char*)&loc, 0); - CdRead(i>>11, (u_long*)_cd_iso_pathtable_buff, CdlModeSpeed); + CdControl(CdlSetloc, (uint8_t*)&loc, 0); + CdRead(i>>11, (uint32_t*)_cd_iso_pathtable_buff, CdlModeSpeed); if( CdReadSync(0, 0) ) { #ifdef DEBUG @@ -165,7 +165,7 @@ static int _CdReadIsoDirectory(int lba) #ifdef DEBUG printf("psxcd_dbg: Seek to sector %d\n", i); #endif - if( !CdControl(CdlSetloc, (u_char*)&loc, 0) ) + if( !CdControl(CdlSetloc, (uint8_t*)&loc, 0) ) { #ifdef DEBUG printf("psxcd: Could not set seek destination.\n"); @@ -180,8 +180,8 @@ static int _CdReadIsoDirectory(int lba) } // Read first sector of directory record - _cd_iso_directory_buff = (u_char*)malloc(2048); - CdRead(1, (u_long*)_cd_iso_directory_buff, CdlModeSpeed); + _cd_iso_directory_buff = (uint8_t*)malloc(2048); + CdRead(1, (uint32_t*)_cd_iso_directory_buff, CdlModeSpeed); if( CdReadSync(0, 0) ) { #ifdef DEBUG @@ -201,7 +201,7 @@ static int _CdReadIsoDirectory(int lba) if( _cd_iso_directory_len > 2048 ) { - if( !CdControl(CdlSetloc, (u_char*)&loc, 0) ) + if( !CdControl(CdlSetloc, (uint8_t*)&loc, 0) ) { #ifdef DEBUG printf("psxcd: Could not set seek destination.\n"); @@ -212,12 +212,12 @@ static int _CdReadIsoDirectory(int lba) free(_cd_iso_directory_buff); i = ((2047+_cd_iso_directory_len)>>11)<<11; - _cd_iso_directory_buff = (u_char*)malloc(i); + _cd_iso_directory_buff = (uint8_t*)malloc(i); #ifdef DEBUG printf("psxcd_dbg: Allocated %d bytes for directory record.\n", i); #endif - CdRead(i>>11, (u_long*)_cd_iso_directory_buff, CdlModeSpeed); + CdRead(i>>11, (uint32_t*)_cd_iso_directory_buff, CdlModeSpeed); if( CdReadSync(0, 0) ) { #ifdef DEBUG @@ -279,7 +279,7 @@ static void dump_directory(void) static void dump_pathtable(void) { - u_char *tbl_pos; + uint8_t *tbl_pos; ISO_PATHTABLE_ENTRY *tbl_entry; ISO_DESCRIPTOR *descriptor; char namebuff[16]; @@ -314,7 +314,7 @@ static void dump_pathtable(void) static int get_pathtable_entry(int entry, ISO_PATHTABLE_ENTRY *tbl, char *namebuff) { int i; - u_char *tbl_pos; + uint8_t *tbl_pos; ISO_PATHTABLE_ENTRY *tbl_entry; ISO_DESCRIPTOR *descriptor; diff --git a/libpsn00b/psxcd/psxcd.c b/libpsn00b/psxcd/psxcd.c index 8f19c8d..6340638 100644 --- a/libpsn00b/psxcd/psxcd.c +++ b/libpsn00b/psxcd/psxcd.c @@ -1,4 +1,4 @@ -#include <sys/types.h> +#include <stdint.h> #include <stdio.h> #include <psxgpu.h> #include "psxcd.h" @@ -6,16 +6,16 @@ #define READ_TIMEOUT 600 // 10 seconds for NTSC extern volatile char _cd_ack_wait; -extern volatile u_char _cd_last_int; -extern volatile u_char _cd_last_mode; -extern volatile u_char _cd_status; +extern volatile uint8_t _cd_last_int; +extern volatile uint8_t _cd_last_mode; +extern volatile uint8_t _cd_status; extern volatile CdlCB _cd_callback_int1_data; -volatile u_char *_cd_result_ptr; +volatile uint8_t *_cd_result_ptr; // For read retry volatile CdlLOC _cd_last_setloc; -volatile u_long *_cd_last_read_addr; +volatile uint32_t *_cd_last_read_addr; volatile int _cd_last_sector_count; int _cd_media_changed; @@ -169,7 +169,7 @@ int CdSync(int mode, unsigned char *result) int CdGetToc(CdlLOC *toc) { - u_char track_info[8]; + uint8_t track_info[8]; int i,tracks; // Get number of tracks @@ -189,7 +189,7 @@ int CdGetToc(CdlLOC *toc) for(i=0; i<tracks; i++) { int t = itob(1+i); - if( !CdControl(CdlGetTD, (u_char*)&t, (u_char*)&toc[i]) ) + if( !CdControl(CdlGetTD, (uint8_t*)&t, (uint8_t*)&toc[i]) ) { return 0; } @@ -234,11 +234,11 @@ int CdMode(void) // CD data read routines volatile int _cd_sector_count = 0; -volatile u_long *_cd_read_addr; -volatile u_char _cd_read_result[8]; -volatile u_long _cd_read_oldcb; -volatile u_long _cd_read_sector_sz; -volatile u_long _cd_read_counter; +volatile uint32_t *_cd_read_addr; +volatile uint8_t _cd_read_result[8]; +volatile uint32_t _cd_read_oldcb; +volatile uint32_t _cd_read_sector_sz; +volatile uint32_t _cd_read_counter; @@ -279,7 +279,7 @@ static void _CdReadReadyCallback(int status, unsigned char *result) } } -int CdRead(int sectors, u_long *buf, int mode) +int CdRead(int sectors, uint32_t *buf, int mode) { // Set sectors to read count _cd_sector_count = sectors; @@ -307,10 +307,10 @@ int CdRead(int sectors, u_long *buf, int mode) _cd_read_oldcb = CdReadyCallback(_CdReadReadyCallback); // Set specified mode - CdControl(CdlSetmode, (u_char*)&mode, 0); + CdControl(CdlSetmode, (uint8_t*)&mode, 0); // Begin reading sectors - CdControl(CdlReadN, 0, (u_char*)_cd_read_result); + CdControl(CdlReadN, 0, (uint8_t*)_cd_read_result); return 0; } @@ -336,10 +336,10 @@ static void CdDoRetry() // Retry read CdControl(CdlSetloc, (void*)&_cd_last_setloc, 0); - CdControl(CdlReadN, 0, (u_char*)_cd_read_result); + CdControl(CdlReadN, 0, (uint8_t*)_cd_read_result); } -int CdReadSync(int mode, u_char *result) +int CdReadSync(int mode, uint8_t *result) { if( (VSync(-1)-_cd_read_counter) > READ_TIMEOUT ) { @@ -371,7 +371,7 @@ int CdReadSync(int mode, u_char *result) return 0; } -u_long CdReadCallback(CdlCB func) +uint32_t CdReadCallback(CdlCB func) { unsigned int old_func; |
