mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Refactor: replace define WIN32 by WIN32_ASM
since it is used for MSVS style asm code only.
This commit is contained in:
parent
b73cf262f1
commit
bdb221b6ac
22
3DMath.h
22
3DMath.h
|
@ -9,7 +9,7 @@ void TransformVectorNormalize(float vec[3], float mtx[4][4]);
|
|||
|
||||
inline void CopyMatrix( float m0[4][4], float m1[4][4] )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm {
|
||||
mov esi, [m1]
|
||||
mov edi, [m0]
|
||||
|
@ -52,12 +52,12 @@ inline void CopyMatrix( float m0[4][4], float m1[4][4] )
|
|||
}
|
||||
#else
|
||||
memcpy( m0, m1, 16 * sizeof( float ) );
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline void Transpose3x3Matrix( float mtx[4][4] )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov esi, [mtx]
|
||||
|
@ -77,7 +77,7 @@ inline void Transpose3x3Matrix( float mtx[4][4] )
|
|||
mov dword ptr [esi+18h], ebx
|
||||
mov dword ptr [esi+24h], eax
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
float tmp;
|
||||
|
||||
tmp = mtx[0][1];
|
||||
|
@ -91,12 +91,12 @@ inline void Transpose3x3Matrix( float mtx[4][4] )
|
|||
tmp = mtx[1][2];
|
||||
mtx[1][2] = mtx[2][1];
|
||||
mtx[2][1] = tmp;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline void Normalize(float v[3])
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm {
|
||||
mov esi, dword ptr [v]
|
||||
// ST(6) ST(5) ST(4) ST(3) ST(2) ST(1) ST
|
||||
|
@ -127,7 +127,7 @@ inline void Normalize(float v[3])
|
|||
End:
|
||||
finit
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
float len;
|
||||
|
||||
len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
|
||||
|
@ -137,14 +137,14 @@ End:
|
|||
v[1] /= len;
|
||||
v[2] /= len;
|
||||
}
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
|
||||
inline float DotProduct(float v0[3], float v1[3])
|
||||
{
|
||||
float dot;
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm {
|
||||
mov esi, dword ptr [v0]
|
||||
mov edi, dword ptr [v1]
|
||||
|
@ -160,9 +160,9 @@ inline float DotProduct(float v0[3], float v1[3])
|
|||
fadd
|
||||
fstp dword ptr [ebx]
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
dot = v0[0]*v1[0] + v0[1]*v1[1] + v0[2]*v1[2];
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
return dot;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,10 +71,9 @@ endif(UNIX)
|
|||
if(WIN32)
|
||||
list(APPEND GLideN64_SOURCES ${GLideN64_SOURCES_WIN})
|
||||
add_definitions(
|
||||
-DWIN32
|
||||
-DWINDOWS
|
||||
-D_WINDOWS
|
||||
-D__WIN32__
|
||||
-D_WIN32
|
||||
-D_WIN32_
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
-D__MSC__
|
||||
)
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NEWGLNINTENDO64_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_ASM;_DEBUG;_WINDOWS;_USRDLL;NEWGLNINTENDO64_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -159,7 +159,7 @@
|
|||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;NEWGLNINTENDO64_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32_ASM;_WINDOWS;_USRDLL;NEWGLNINTENDO64_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
@ -186,7 +186,7 @@
|
|||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<PreprocessorDefinitions>MUPENPLUSAPI;WIN32;_WINDOWS;_USRDLL;NEWGLNINTENDO64_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>MUPENPLUSAPI;WIN32_ASM;_WINDOWS;_USRDLL;NEWGLNINTENDO64_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
@ -238,7 +238,7 @@
|
|||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_mupenplus|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config_mupen.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CRC.cpp" />
|
||||
<ClCompile Include="Debug.cpp" />
|
||||
|
|
|
@ -114,10 +114,10 @@
|
|||
<ClCompile Include="3DMath.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config_mupen.cpp">
|
||||
<ClCompile Include="Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config.cpp">
|
||||
<ClCompile Include="Config_mupen.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
|
6
RSP.cpp
6
RSP.cpp
|
@ -15,7 +15,7 @@ RSPInfo RSP;
|
|||
void RSP_LoadMatrix( f32 mtx[4][4], u32 address )
|
||||
{
|
||||
f32 recip = 1.5258789e-05f;
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm {
|
||||
mov esi, dword ptr [RDRAM];
|
||||
add esi, dword ptr [address];
|
||||
|
@ -59,7 +59,7 @@ LoadLoop:
|
|||
add edi, 10h
|
||||
loop LoadLoop
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
# ifdef X86_ASM
|
||||
__asm__ __volatile__(
|
||||
".intel_syntax noprefix" "\n\t"
|
||||
|
@ -115,7 +115,7 @@ LoadLoop:
|
|||
for (j = 0; j < 4; j++)
|
||||
mtx[i][j] = (GLfloat)(n64Mat->integer[i][j^1]) + (GLfloat)(n64Mat->fraction[i][j^1]) * recip;
|
||||
# endif // !X86_ASM
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
void RSP_ProcessDList()
|
||||
|
|
108
convert.h
108
convert.h
|
@ -104,7 +104,7 @@ const volatile unsigned char One2Eight[2] =
|
|||
|
||||
static inline void UnswapCopy( void *src, void *dest, u32 numBytes )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ecx, 0
|
||||
|
@ -167,7 +167,7 @@ TrailingLoop:
|
|||
loop TrailingLoop
|
||||
Done:
|
||||
}
|
||||
# else // WIN32
|
||||
# else // WIN32_ASM
|
||||
// copy leading bytes
|
||||
int leadingBytes = ((long)src) & 3;
|
||||
if (leadingBytes != 0)
|
||||
|
@ -214,12 +214,12 @@ Done:
|
|||
src = (void *)((long)src -1);
|
||||
}
|
||||
}
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
static inline void DWordInterleave( void *mem, u32 numDWords )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm {
|
||||
mov esi, dword ptr [mem]
|
||||
mov edi, dword ptr [mem]
|
||||
|
@ -234,7 +234,7 @@ DWordInterleaveLoop:
|
|||
add edi, 8
|
||||
loop DWordInterleaveLoop
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
int tmp;
|
||||
while( numDWords-- )
|
||||
{
|
||||
|
@ -243,12 +243,12 @@ DWordInterleaveLoop:
|
|||
*(int *)((long)mem + 4) = tmp;
|
||||
mem = (void *)((long)mem + 8);
|
||||
}
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline void QWordInterleave( void *mem, u32 numDWords )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
// Interleave the line on the qword
|
||||
|
@ -272,7 +272,7 @@ QWordInterleaveLoop:
|
|||
add edi, 12
|
||||
loop QWordInterleaveLoop
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
numDWords >>= 1; // qwords
|
||||
while( numDWords-- )
|
||||
{
|
||||
|
@ -285,19 +285,19 @@ QWordInterleaveLoop:
|
|||
*(int *)((long)mem + 12) = tmp1;
|
||||
mem = (void *)((long)mem + 16);
|
||||
}
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
|
||||
inline u32 swapdword( u32 value )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov eax, dword ptr [value]
|
||||
bswap eax
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
#ifdef ARM_ASM
|
||||
asm("rev %0, %0" : "+r"(value)::);
|
||||
return value;
|
||||
|
@ -307,30 +307,30 @@ inline u32 swapdword( u32 value )
|
|||
((value & 0x0000ff00) << 8) |
|
||||
((value & 0x000000ff) << 24);
|
||||
#endif // ARM_ASM
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u16 swapword( u16 value )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ax, word ptr [value]
|
||||
xchg ah, al
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
#ifdef ARM_ASM
|
||||
asm("rev16 %0, %0" : "+r"(value)::);
|
||||
return value;
|
||||
#else
|
||||
return (value << 8) | (value >> 8);
|
||||
#endif // ARM_ASM
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u16 RGBA8888_RGBA4444( u32 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ebx, dword ptr [color]
|
||||
|
@ -352,17 +352,17 @@ inline u16 RGBA8888_RGBA4444( u32 color )
|
|||
shr bl, 4
|
||||
or al, bl
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
return ((color & 0x000000f0) << 8) | // r
|
||||
((color & 0x0000f000) >> 4) | // g
|
||||
((color & 0x00f00000) >> 16) | // b
|
||||
((color & 0xf0000000) >> 28); // a
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u32 RGBA5551_RGBA8888( u16 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ebx, 00000000h
|
||||
|
@ -390,7 +390,7 @@ inline u32 RGBA5551_RGBA8888( u16 color )
|
|||
and bx, 1Fh
|
||||
mov al, byte ptr [Five2Eight+ebx]
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
color = swapword( color );
|
||||
u8 r, g, b, a;
|
||||
r = Five2Eight[color >> 11];
|
||||
|
@ -398,26 +398,26 @@ inline u32 RGBA5551_RGBA8888( u16 color )
|
|||
b = Five2Eight[(color >> 1) & 0x001f];
|
||||
a = One2Eight [(color ) & 0x0001];
|
||||
return (a << 24) | (b << 16) | (g << 8) | r;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
// Just swaps the word
|
||||
inline u16 RGBA5551_RGBA5551( u16 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ax, word ptr [color]
|
||||
xchg ah, al
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
return swapword( color );
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u32 IA88_RGBA8888( u16 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov cx, word ptr [color]
|
||||
|
@ -430,17 +430,17 @@ inline u32 IA88_RGBA8888( u16 color )
|
|||
mov ah, cl
|
||||
mov al, cl
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
// ok
|
||||
u8 a = color >> 8;
|
||||
u8 i = color & 0x00FF;
|
||||
return (a << 24) | (i << 16) | (i << 8) | i;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u16 IA88_RGBA4444( u16 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov cx, word ptr [color]
|
||||
|
@ -454,16 +454,16 @@ inline u16 IA88_RGBA4444( u16 color )
|
|||
shr ch, 4
|
||||
or al, ch
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
u8 i = color >> 12;
|
||||
u8 a = (color >> 4) & 0x000F;
|
||||
return (i << 12) | (i << 8) | (i << 4) | a;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u16 IA44_RGBA4444( u8 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov cl, byte ptr [color]
|
||||
|
@ -474,14 +474,14 @@ inline u16 IA44_RGBA4444( u8 color )
|
|||
shl cl, 4
|
||||
or ah, cl
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
return ((color & 0xf0) << 8) | ((color & 0xf0) << 4) | (color);
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u32 IA44_RGBA8888( u8 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ebx, 00000000h
|
||||
|
@ -503,16 +503,16 @@ inline u32 IA44_RGBA8888( u8 color )
|
|||
mov ah, ch
|
||||
mov al, ch
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
u8 i = Four2Eight[color >> 4];
|
||||
u8 a = Four2Eight[color & 0x0F];
|
||||
return (a << 24) | (i << 16) | (i << 8) | i;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u16 IA31_RGBA4444( u8 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ebx, 00000000h
|
||||
|
@ -531,16 +531,16 @@ inline u16 IA31_RGBA4444( u8 color )
|
|||
mov ch, byte ptr [One2Four+ebx]
|
||||
or al, ch
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
u8 i = Three2Four[color >> 1];
|
||||
u8 a = One2Four[color & 0x01];
|
||||
return (i << 12) | (i << 8) | (i << 4) | a;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u32 IA31_RGBA8888( u8 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ebx, 00000000h
|
||||
|
@ -562,16 +562,16 @@ inline u32 IA31_RGBA8888( u8 color )
|
|||
mov ah, ch
|
||||
mov al, ch
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
u8 i = Three2Eight[color >> 1];
|
||||
u8 a = One2Eight[color & 0x01];
|
||||
return (i << 24) | (i << 16) | (i << 8) | a;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u16 I8_RGBA4444( u8 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov cl, byte ptr [color]
|
||||
|
@ -582,15 +582,15 @@ inline u16 I8_RGBA4444( u8 color )
|
|||
or al, cl
|
||||
mov ah, al
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
u8 c = color >> 4;
|
||||
return (c << 12) | (c << 8) | (c << 4) | c;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u32 I8_RGBA8888( u8 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov cl, byte ptr [color]
|
||||
|
@ -601,14 +601,14 @@ inline u32 I8_RGBA8888( u8 color )
|
|||
mov ah, cl
|
||||
mov al, cl
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
return (color << 24) | (color << 16) | (color << 8) | color;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u16 I4_RGBA4444( u8 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov cl, byte ptr [color]
|
||||
|
@ -617,17 +617,17 @@ inline u16 I4_RGBA4444( u8 color )
|
|||
or al, cl
|
||||
mov ah, al
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
u16 ret = color & 0x0f;
|
||||
ret |= ret << 4;
|
||||
ret |= ret << 8;
|
||||
return ret;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
inline u32 I4_RGBA8888( u8 color )
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32_ASM
|
||||
__asm
|
||||
{
|
||||
mov ebx, 00000000h
|
||||
|
@ -641,11 +641,11 @@ inline u32 I4_RGBA8888( u8 color )
|
|||
mov ah, cl
|
||||
mov al, cl
|
||||
}
|
||||
#else // WIN32
|
||||
#else // WIN32_ASM
|
||||
u8 c = Four2Eight[color];
|
||||
c |= c << 4;
|
||||
return (c << 24) | (c << 16) | (c << 8) | c;
|
||||
#endif // WIN32
|
||||
#endif // WIN32_ASM
|
||||
}
|
||||
|
||||
#endif // CONVERT_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user