comparison Plugins/Input/sexypsf/PsxMem.c @ 640:f26682a2825b trunk

[svn] Addresses most of the warnings in the code, and uses a -W CFLAG to disable the non-null checks. From external contributor Harald van Dijk (Gentoo).
author chainsaw
date Sat, 18 Feb 2006 16:15:16 -0800
parents e089ce1ba088
children d539e5c5f730
comparison
equal deleted inserted replaced
639:9d2c175e458e 640:f26682a2825b
19 #include <string.h> 19 #include <string.h>
20 #include <stdlib.h> 20 #include <stdlib.h>
21 21
22 #include "PsxCommon.h" 22 #include "PsxCommon.h"
23 23
24 void LoadPSXMem(u32 address, s32 length, char *data) 24 void LoadPSXMem(u32 address, s32 length, unsigned char *data)
25 { 25 {
26 //printf("%08x %08x\n",address,length); 26 //printf("%08x %08x\n",address,length);
27 while(length>0) 27 while(length>0)
28 { 28 {
29 if(address&65535) 29 if(address&65535)
70 for (i=0; i<0x80; i++) psxMemLUT[i + 0x0000] = &psxM[(i & 0x1f) << 16]; 70 for (i=0; i<0x80; i++) psxMemLUT[i + 0x0000] = &psxM[(i & 0x1f) << 16];
71 71
72 memcpy(psxMemLUT + 0x8000, psxMemLUT, 0x80 * sizeof *psxMemLUT); 72 memcpy(psxMemLUT + 0x8000, psxMemLUT, 0x80 * sizeof *psxMemLUT);
73 memcpy(psxMemLUT + 0xa000, psxMemLUT, 0x80 * sizeof *psxMemLUT); 73 memcpy(psxMemLUT + 0xa000, psxMemLUT, 0x80 * sizeof *psxMemLUT);
74 74
75 for (i=0; i<0x01; i++) psxMemLUT[i + 0x1f00] = (u32)&psxP[i << 16]; 75 for (i=0; i<0x01; i++) psxMemLUT[i + 0x1f00] = &psxP[i << 16];
76 76
77 for (i=0; i<0x01; i++) psxMemLUT[i + 0x1f80] = (u32)&psxH[i << 16]; 77 for (i=0; i<0x01; i++) psxMemLUT[i + 0x1f80] = &psxH[i << 16];
78 78
79 for (i=0; i<0x08; i++) psxMemLUT[i + 0xbfc0] = (u32)&psxR[i << 16]; 79 for (i=0; i<0x08; i++) psxMemLUT[i + 0xbfc0] = &psxR[i << 16];
80 80
81 return 0; 81 return 0;
82 } 82 }
83 83
84 void psxMemReset() { 84 void psxMemReset() {
100 free(psxR); 100 free(psxR);
101 101
102 if (psxMemLUT) 102 if (psxMemLUT)
103 free(psxMemLUT); 103 free(psxMemLUT);
104 104
105 psxM = psxP = psxH = psxR = psxMemLUT = NULL; 105 psxM = psxP = psxH = psxR = NULL;
106 psxMemLUT = NULL;
106 } 107 }
107 108
108 u8 psxMemRead8(u32 mem) { 109 u8 psxMemRead8(u32 mem) {
109 char *p; 110 char *p;
110 u32 t; 111 u32 t;