Advertisement
Guest User

Untitled

a guest
Oct 29th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.52 KB | None | 0 0
  1. diff --git a/src-0.2.97.13/cpu/sh2/sh2.cpp b/src-0.2.97.13/cpu/sh2/sh2.cpp
  2. index 3ddb08f..32008eb 100644
  3. --- a/src-0.2.97.13/cpu/sh2/sh2.cpp
  4. +++ b/src-0.2.97.13/cpu/sh2/sh2.cpp
  5. @@ -30,6 +30,7 @@
  6.   *****************************************************************************/
  7.  
  8.  #include <stdio.h>
  9. +#include <stdint.h>
  10.  #include <stdlib.h>
  11.  #include <string.h>
  12.  
  13. @@ -253,7 +254,7 @@ int Sh2MapMemory(unsigned char* pMemory, unsigned int nStart, unsigned int nEnd,
  14.     return 0;
  15.  }
  16.  
  17. -int Sh2MapHandler(unsigned int nHandler, unsigned int nStart, unsigned int nEnd, int nType)
  18. +int Sh2MapHandler(uintptr_t nHandler, unsigned int nStart, unsigned int nEnd, int nType)
  19.  {
  20.     unsigned char** pMemMap = pSh2Ext->MemMap + (nStart >> SH2_SHIFT);
  21.     int need_mirror = (nStart < 0x08000000) ? 1 : 0;
  22. @@ -521,11 +522,11 @@ INLINE UINT8 RB(UINT32 A)
  23.    
  24.     unsigned char * pr;
  25.     pr = pSh2Ext->MemMap[ A >> SH2_SHIFT ];
  26. -   if ( (unsigned int)pr >= SH2_MAXHANDLER ) {
  27. +   if ( (uintptr_t)pr >= SH2_MAXHANDLER ) {
  28.         A ^= 3;
  29.         return pr[A & SH2_PAGEM];
  30.     }
  31. -   return pSh2Ext->ReadByte[(unsigned int)pr](A);
  32. +   return pSh2Ext->ReadByte[(uintptr_t)pr](A);
  33.  }
  34.  
  35.  INLINE UINT16 RW(UINT32 A)
  36. @@ -537,12 +538,12 @@ INLINE UINT16 RW(UINT32 A)
  37.    
  38.     unsigned char * pr;
  39.     pr = pSh2Ext->MemMap[ A >> SH2_SHIFT ];
  40. -   if ( (unsigned int)pr >= SH2_MAXHANDLER ) {
  41. +   if ( (uintptr_t)pr >= SH2_MAXHANDLER ) {
  42.         A ^= 2;
  43.         //return (pr[A & SH2_PAGEM] << 8) | pr[(A & SH2_PAGEM) + 1];
  44.         return *((unsigned short *)(pr + (A & SH2_PAGEM)));
  45.     }
  46. -   return pSh2Ext->ReadWord[(unsigned int)pr](A);
  47. +   return pSh2Ext->ReadWord[(uintptr_t)pr](A);
  48.  }
  49.  
  50.  INLINE UINT16 OPRW(UINT32 A)
  51. @@ -550,7 +551,7 @@ INLINE UINT16 OPRW(UINT32 A)
  52.  
  53.     unsigned char * pr;
  54.     pr = pSh2Ext->MemMap[ (A >> SH2_SHIFT) + SH2_WADD * 2 ];
  55. -   if ( (unsigned int)pr >= SH2_MAXHANDLER ) {
  56. +   if ( (uintptr_t)pr >= SH2_MAXHANDLER ) {
  57.         A ^= 2;
  58.         return *((unsigned short *)(pr + (A & SH2_PAGEM)));
  59.     }
  60. @@ -567,11 +568,11 @@ INLINE UINT32 RL(UINT32 A)
  61.    
  62.     unsigned char * pr;
  63.     pr = pSh2Ext->MemMap[ A >> SH2_SHIFT ];
  64. -   if ( (unsigned int)pr >= SH2_MAXHANDLER ) {
  65. +   if ( (uintptr_t)pr >= SH2_MAXHANDLER ) {
  66.         //return (pr[(A & SH2_PAGEM) + 0] << 24) | (pr[(A & SH2_PAGEM) + 1] << 16) | (pr[(A & SH2_PAGEM) + 2] <<  8) | (pr[(A & SH2_PAGEM) + 3] <<  0);
  67.         return *((unsigned int *)(pr + (A & SH2_PAGEM)));
  68.     }
  69. -   return pSh2Ext->ReadLong[(unsigned int)pr](A);
  70. +   return pSh2Ext->ReadLong[(uintptr_t)pr](A);
  71.  }
  72.  
  73.  INLINE void WB(UINT32 A, UINT8 V)
  74. @@ -583,12 +584,12 @@ INLINE void WB(UINT32 A, UINT8 V)
  75.    
  76.     unsigned char* pr;
  77.     pr = pSh2Ext->MemMap[(A >> SH2_SHIFT) + SH2_WADD];
  78. -   if ((unsigned int)pr >= SH2_MAXHANDLER) {
  79. +   if ((uintptr_t)pr >= SH2_MAXHANDLER) {
  80.         A ^= 3;
  81.         pr[A & SH2_PAGEM] = (unsigned char)V;
  82.         return;
  83.     }
  84. -   pSh2Ext->WriteByte[(unsigned int)pr](A, V);
  85. +   pSh2Ext->WriteByte[(uintptr_t)pr](A, V);
  86.  }
  87.  
  88.  INLINE void WW(UINT32 A, UINT16 V)
  89. @@ -600,12 +601,12 @@ INLINE void WW(UINT32 A, UINT16 V)
  90.  
  91.     unsigned char * pr;
  92.     pr = pSh2Ext->MemMap[(A >> SH2_SHIFT) + SH2_WADD];
  93. -   if ((unsigned int)pr >= SH2_MAXHANDLER) {
  94. +   if ((uintptr_t)pr >= SH2_MAXHANDLER) {
  95.         A ^= 2;
  96.         *((unsigned short *)(pr + (A & SH2_PAGEM))) = (unsigned short)V;
  97.         return;
  98.     }
  99. -   pSh2Ext->WriteWord[(unsigned int)pr](A, V);
  100. +   pSh2Ext->WriteWord[(uintptr_t)pr](A, V);
  101.  }
  102.  
  103.  INLINE void WL(UINT32 A, UINT32 V)
  104. @@ -616,11 +617,11 @@ INLINE void WL(UINT32 A, UINT32 V)
  105.     program_write_dword_32be(A & AM,V); */
  106.     unsigned char * pr;
  107.     pr = pSh2Ext->MemMap[(A >> SH2_SHIFT) + SH2_WADD];
  108. -   if ((unsigned int)pr >= SH2_MAXHANDLER) {
  109. +   if ((uintptr_t)pr >= SH2_MAXHANDLER) {
  110.         *((unsigned int *)(pr + (A & SH2_PAGEM))) = (unsigned int)V;
  111.         return;
  112.     }
  113. -   pSh2Ext->WriteLong[(unsigned int)pr](A, V);
  114. +   pSh2Ext->WriteLong[(uintptr_t)pr](A, V);
  115.  }
  116.  
  117.  INLINE void sh2_exception(/*const char *message,*/ int irqline)
  118. diff --git a/src-0.2.97.13/cpu/sh2/sh2.h b/src-0.2.97.13/cpu/sh2/sh2.h
  119. index 07ef9b9..01c704a 100644
  120. --- a/src-0.2.97.13/cpu/sh2/sh2.h
  121. +++ b/src-0.2.97.13/cpu/sh2/sh2.h
  122. @@ -26,7 +26,7 @@ void Sh2Reset(unsigned int pc, unsigned r15);
  123.  int Sh2Run(int cycles);
  124.  
  125.  int Sh2MapMemory(unsigned char* pMemory, unsigned int nStart, unsigned int nEnd, int nType);
  126. -int Sh2MapHandler(unsigned int nHandler, unsigned int nStart, unsigned int nEnd, int nType);
  127. +int Sh2MapHandler(uintptr_t nHandler, unsigned int nStart, unsigned int nEnd, int nType);
  128.  
  129.  int Sh2SetReadByteHandler(int i, pSh2ReadByteHandler pHandler);
  130.  int Sh2SetWriteByteHandler(int i, pSh2WriteByteHandler pHandler);
  131.  
  132.  
  133.  
  134.  
  135.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement