Mercurial > mm7
changeset 2416:8b04ba723324
misstake in LoadSound
author | Ritor1 |
---|---|
date | Mon, 21 Jul 2014 17:37:03 +0600 |
parents | f4af3b203f65 |
children | 15440e9ae7b6 |
files | AudioPlayer.cpp DirectX11.cpp DirectX11.h IconFrameTable.cpp LOD.cpp LightmapBuilder.cpp LightsStack.cpp Render.cpp mm7_2.cpp mm7_4.cpp |
diffstat | 10 files changed, 48 insertions(+), 126 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/AudioPlayer.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -2731,7 +2731,7 @@ pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize = pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize; if ( pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize ) { - ReadFile(pAudioPlayer->hAudioSnd, pOutBuff->pData, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize + 7, &NumberOfBytesRead, 0);// Ritor1: include +7 for pSounds[20] + ReadFile(pAudioPlayer->hAudioSnd, pOutBuff->pData, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize, &NumberOfBytesRead, 0);// Ritor1: pSounds[20] } else {
--- a/DirectX11.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/DirectX11.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -1,4 +1,4 @@ -#define _CRTDBG_MAP_ALLOC +/*#define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> @@ -108,4 +108,4 @@ void Render() { -} \ No newline at end of file +}*/ \ No newline at end of file
--- a/DirectX11.h Sun Jul 20 22:38:31 2014 +0600 +++ b/DirectX11.h Mon Jul 21 17:37:03 2014 +0600 @@ -1,4 +1,4 @@ -#pragma once +/*#pragma once #define WIN32_LEAN_AND_MEAN #include "OSWindow.h" @@ -195,3 +195,4 @@ friend void Present_NoColorKey(); }; +*/ \ No newline at end of file
--- a/IconFrameTable.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/IconFrameTable.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -40,18 +40,13 @@ //----- (00494FBF) -------------------------------------------------------- void IconFrameTable::InitializeAnimation(unsigned int uIconID) { - unsigned int v3; // edi@3 - const char *i; // eax@3 - - if ( (signed int)uIconID <= (signed int)this->uNumIcons && (uIconID & 0x80000000u) == 0 ) + if ( uIconID && (signed int)uIconID <= (signed int)this->uNumIcons ) { - v3 = uIconID; - for ( i = this->pIcons[uIconID].pTextureName; ; i = this->pIcons[v3].pTextureName ) + for ( uint i = uIconID; ; ++i ) { - this->pIcons[v3].uTextureID = pIcons_LOD->LoadTexture(i, TEXTURE_16BIT_PALETTE); - if ( !(this->pIcons[v3].uFlags & 1) ) + this->pIcons[i].uTextureID = pIcons_LOD->LoadTexture(this->pIcons[i].pTextureName, TEXTURE_16BIT_PALETTE); + if ( !(this->pIcons[i].uFlags & 1) ) break; - ++v3; } } }
--- a/LOD.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/LOD.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -160,65 +160,39 @@ //----- (004AC67E) -------------------------------------------------------- int LODFile_Sprites::LoadSpriteFromFile(LODSprite *pSpriteHeader, const char *pContainer) { - FILE *v3; // eax@1 - FILE *v4; // ebx@1 - int result; // eax@2 - LODSprite *v6; // esi@3 - LODSprite_stru0 *v7; // eax@3 - size_t v8; // ST10_4@3 - int *v9; // ebx@3 - int v10; // eax@3 - void *v11; // eax@5 - LODSprite_stru0 *v12; // eax@6 - void *v13; // ecx@6 - LODSprite_stru0 *i; // edx@6 FILE *File; // [sp+4h] [bp-4h]@1 void *DstBufa; // [sp+10h] [bp+8h]@4 int Sizea; // [sp+14h] [bp+Ch]@3 - v3 = FindContainer(pContainer, 0); - v4 = v3; - File = v3; - if ( v3 ) + File = FindContainer(pContainer, 0); + if ( File ) { - v6 = pSpriteHeader; - fread(pSpriteHeader, 1, 0x20u, v3); + fread(pSpriteHeader, 1, 0x20u, File); strcpy(pSpriteHeader->pName, pContainer); Sizea = pSpriteHeader->uSpriteSize; - v7 = (LODSprite_stru0 *)malloc(8 * v6->uHeight); - v8 = 8 * pSpriteHeader->uHeight; - pSpriteHeader->pSpriteLines = v7; - fread(v7, 1, v8, v4); + pSpriteHeader->pSpriteLines = (LODSprite_stru0 *)malloc(8 * pSpriteHeader->uHeight); + fread(pSpriteHeader->pSpriteLines, 1, 8 * pSpriteHeader->uHeight, File); - v9 = &pSpriteHeader->uDecompressedSize; - v10 = pSpriteHeader->uDecompressedSize; - if ( v10 ) + if ( pSpriteHeader->uDecompressedSize ) { - pSpriteHeader->pDecompressedBytes = malloc(v10); + pSpriteHeader->pDecompressedBytes = malloc(pSpriteHeader->uDecompressedSize); DstBufa = malloc(Sizea); - fread(DstBufa, 1u, Sizea, File); - zlib::MemUnzip(v6->pDecompressedBytes, (unsigned int *)&v6->uDecompressedSize, DstBufa, v6->uSpriteSize); - v6->uSpriteSize = *v9; + fread(DstBufa, 1, Sizea, File); + zlib::MemUnzip(pSpriteHeader->pDecompressedBytes, (unsigned int *)&pSpriteHeader->uDecompressedSize, DstBufa, pSpriteHeader->uSpriteSize); + pSpriteHeader->uSpriteSize = pSpriteHeader->uDecompressedSize; free(DstBufa); } else { - v11 = malloc(Sizea); - pSpriteHeader->pDecompressedBytes = v11; - fread(v11, 1u, Sizea, File); + pSpriteHeader->pDecompressedBytes = malloc(Sizea); + fread(pSpriteHeader->pDecompressedBytes, 1, Sizea, File); } - v12 = v6->pSpriteLines; - v13 = v6->pDecompressedBytes; - for ( i = &v12[v6->uHeight]; v12 < i; i = &v6->pSpriteLines[v6->uHeight] ) - { - v12->pos = (char *)v12->pos + (unsigned int)v13; - ++v12; - } - result = 1; + for ( uint i = 0; i < pSpriteHeader->uHeight; i++ ) + pSpriteHeader->pSpriteLines[i].pos += (unsigned int)pSpriteHeader->pDecompressedBytes; + return 1; } else - result = -1; - return result; + return -1; } //----- (004AC795) -------------------------------------------------------- @@ -330,14 +304,12 @@ //----- (004ACADA) -------------------------------------------------------- void LODFile_Sprites::ReleaseLostHardwareSprites() { - //LODFile_Sprites *v1; // esi@1 signed int v2; // ebx@2 int v3; // edi@3 IDirectDrawSurface *v4; // eax@4 IDirect3DTexture2 *v5; // eax@6 IDirectDrawSurface *v6; // ST00_4@8 - //v1 = this; if ( this->pHardwareSprites ) { v2 = 0; @@ -412,7 +384,7 @@ int result; // eax@1 int v5; // esi@2 int v6; // ST18_4@2 - signed int v7; // eax@2 + //signed int v7; // eax@2 signed int v8; // ebx@2 int v9; // ebx@2 int *v10; // ecx@2 @@ -507,11 +479,11 @@ v87 = (signed __int64)0x100000000ui64 / result; v48 = (signed __int64)0x100000000ui64 / result; v62 = (signed __int64)0x100000000ui64 / v5; - v7 = this->uHeight; + //v7 = this->uHeight; v8 = (signed int)((signed __int64)0x100000000ui64 / v5) >> 1; v53 = v8; v70 = (this->uHeight << 16) - v8; - v49 = v7; + v49 = this->uHeight; v69 = v3->uTargetPitch; __debugbreak(); // target surface will most likely be 32bit, but this sub awaits 16bits @@ -520,7 +492,7 @@ v61 = v3->pPalette; v9 = (v6 * this->uWidth + 0x8000) >> 16; v72 = v3->uScreenSpaceY; - result = (v5 * v7 + 0x8000) >> 16; + result = (v5 * this->uHeight + 0x8000) >> 16; v10 = (int *)(v72 - result + 1); v11 = v3->uScreenSpaceX - (v9 >> 1) + 1; v65 = v72 - result + 1; @@ -804,7 +776,6 @@ int i; // [sp+20h] [bp+8h]@1 result = (int)a2; - // v14 = this; v4 = a2->uTargetPitch; __debugbreak(); // sub expects 16bit target surface, we may have 32bit @@ -2095,6 +2066,9 @@ //----- (004101B1) -------------------------------------------------------- int LODFile_IconsBitmaps::ReloadTexture(Texture *pDst, const char *pContainer, int mode) { + /////////////////////////////////////////////// + //Вызывается когда нажимаем кнопку НОВАЯ ИГРА// + /////////////////////////////////////////////// Texture *v6; // esi@2 unsigned int v7; // ebx@6 unsigned int v8; // ecx@6 @@ -2153,6 +2127,9 @@ //----- (0040FC08) -------------------------------------------------------- int LODFile_IconsBitmaps::LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType) { + ////////////////////////////////// + //Вызывается сразу после запуска// + ////////////////////////////////// Texture *v8; // esi@3 size_t v11; // eax@14 enum TEXTURE_TYPE v12; // eax@14 @@ -2162,18 +2139,9 @@ size_t v22; // ST2C_4@29 const void *v23; // ecx@29 void *v30; // eax@30 - signed int v34; // eax@37 - unsigned __int8 *v35; // ecx@37 - unsigned __int8 *v36; // ecx@37 - unsigned __int8 *v37; // eax@37 - signed int v41; // ecx@43 signed int v42; // ecx@48 - //v4 = pContainer; - //v5 = this; - //v6 = FindContainer(pContainer, 0); - //File = v6; FILE* pFile = FindContainer(pContainer, false); if (!pFile) return -1; @@ -2217,9 +2185,6 @@ } return v13; } - //v15 = v8->uTextureSize; - //v16 = &v8->uDecompressedSize; - //pOutTex = (Texture *)v8->uTextureSize; if ( !v8->uDecompressedSize || dword_011BA4 ) { v8->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)malloc(v8->uTextureSize); @@ -2243,15 +2208,10 @@ v8->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)malloc((unsigned int)pOutTex); memcpy(v8->pLevelOfDetail0_prolly_alpha_mask, v23, v22); v8->uTextureWidth = (signed __int16)v8->uTextureWidth / 2; - //v24 = v8->uTextureWidth; v8->uTextureHeight = (signed __int16)v8->uTextureHeight / 2; - //v25 = v8->uTextureHeight; --v8->uWidthLn2; --v8->uHeightLn2; v8->uWidthMinus1 = v8->uTextureWidth - 1; - //v26 = v25 - 1; - //v27 = (signed __int16)v8->uTextureWidth * (signed __int16)v25; - //v28 = pOutTex; v8->uHeightMinus1 = v8->uTextureHeight - 1; v8->uSizeOfMaxLevelOfDetail = (signed __int16)v8->uTextureWidth * (signed __int16)v8->uTextureHeight; v8->uTextureSize = (unsigned int)pOutTex; @@ -2293,20 +2253,16 @@ if ( v8->pBits & 2 ) { - v34 = v8->uSizeOfMaxLevelOfDetail; - v35 = &v8->pLevelOfDetail0_prolly_alpha_mask[v34]; - v8->pLevelOfDetail1 = v35; - v36 = &v35[v34 >> 2]; - v8->pLevelOfDetail2 = v36; - v37 = &v36[v34 >> 4]; + v8->pLevelOfDetail1 = &v8->pLevelOfDetail0_prolly_alpha_mask[v8->uSizeOfMaxLevelOfDetail]; + v8->pLevelOfDetail2 = &v8->pLevelOfDetail1[v8->uSizeOfMaxLevelOfDetail >> 2]; + v8->pLevelOfDetail3 = &v8->pLevelOfDetail2[v8->uSizeOfMaxLevelOfDetail >> 4]; } else { - v37 = 0; + v8->pLevelOfDetail1 = 0; v8->pLevelOfDetail2 = 0; - v8->pLevelOfDetail1 = 0; + v8->pLevelOfDetail3 = 0; } - v8->pLevelOfDetail3 = v37; for ( v41 = 1; v41 < 15; ++v41 ) { if ( 1 << v41 == v8->uTextureWidth ) @@ -2397,7 +2353,6 @@ return 1; } - Texture *LODFile_IconsBitmaps::LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType) { uint id = LoadTexture(pContainer, uTextureType); @@ -2410,12 +2365,6 @@ //----- (0040FB20) -------------------------------------------------------- unsigned int LODFile_IconsBitmaps::LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType) { - //LODFile_IconsBitmaps *v3; // esi@1 - //unsigned int v4; // edi@1 - //Texture *v5; // ebx@2 - - //v3 = this; - //v4 = 0; areWeLoadingTexture = 1; for (uint i = 0; i < uNumLoadedFiles; ++i)
--- a/LightmapBuilder.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/LightmapBuilder.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -39,19 +39,11 @@ field_C18 = 0; } - - - - //----- (0045BB06) -------------------------------------------------------- LightmapBuilder::LightmapBuilder() { } - - - - //----- (0045BC07) -------------------------------------------------------- bool LightmapBuilder::ApplyLights(stru320 *a2, stru154 *a3, unsigned int uNumVertices, RenderVertexSoft *a5, IndoorCameraD3D_Vec4 *a6, char uClipFlag) { @@ -118,18 +110,10 @@ Lightmap *v11; // edi@3 double v17; // st7@5 double v24; // st7@6 -// int v31; // eax@8 -// int v32; // ebx@8 -// unsigned int v33; // ecx@8 -// int v34; // edx@9 -// int v35; // edx@11 -// unsigned int v36; // edx@13 -// int v37; // ecx@14 double v38; // st7@14 double v39; // st7@16 double v40; // st7@16 int v45; // eax@24 -// int v53; // [sp-8h] [bp-54h]@34 if (fabsf(radius) < 1e-6f) return true;
--- a/LightsStack.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/LightsStack.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -34,11 +34,11 @@ bool LightsStack_StationaryLight_::AddLight( __int16 x, __int16 y, __int16 z, __int16 a5, unsigned char r, unsigned char g, unsigned char b, char uLightType ) { - unsigned int v9; // eax@1 - std::string v11; // [sp-18h] [bp-18h]@3 + //unsigned int v9; // eax@1 + //std::string v11; // [sp-18h] [bp-18h]@3 - v9 = this->uNumLightsActive; - if ( (signed int)v9 >= 400 ) + //v9 = this->uNumLightsActive; + if ( (signed int)this->uNumLightsActive >= 400 ) { MessageBoxW(nullptr, L"Too many stationary lights!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\StationaryLightStack.cpp:45", 0); return false;
--- a/Render.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/Render.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -2967,21 +2967,14 @@ //----- (0049FD3A) -------------------------------------------------------- void Render::_49FD3A_fullscreen() { - //Render *v2; // esi@1 - //IDirectDrawSurface4 *v3; // eax@6 - //IDirectDrawSurface4 *v4; // ST0C_4@6 RECT v5; // [sp+8h] [bp-10h]@6 - //Render* a1 = this; - //v2 = this; if ( this->pRenderD3D ) { if (pFrontBuffer4->IsLost() == DDERR_SURFACELOST) pFrontBuffer4->Restore(); if (pBackBuffer4->IsLost() == DDERR_SURFACELOST) pBackBuffer4->Restore(); - //v3 = this->pBackBuffer4; - //v4 = this->pFrontBuffer4; v5.top = 0; v5.bottom = window->GetHeight(); v5.left = 0; @@ -3355,7 +3348,7 @@ //void *v28; // [sp+2FCh] [bp-10h]@2 int v29; // [sp+308h] [bp-4h]@2 - __debugbreak(); // Nomad + //__debugbreak(); // Nomad //v2 = this; this->using_software_screen_buffer = 0;
--- a/mm7_2.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/mm7_2.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -2040,6 +2040,8 @@ uCPUSpeed = Rect.bottom;*/ uCPUSpeed = 2048; // about 2GHz + //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );//Ritor1: for memory test(для проверки памяти) + if (!MM7_Initialize(640, 480))//задаётся размер окна { Log::Warning(L"MM init: failed");
--- a/mm7_4.cpp Sun Jul 20 22:38:31 2014 +0600 +++ b/mm7_4.cpp Mon Jul 21 17:37:03 2014 +0600 @@ -154,7 +154,6 @@ unsigned int v3; // eax@7 unsigned int v4; // edx@8 int v6; // edi@17 - int v12; // eax@26 //__debugbreak();//Ritor1 for ( uint pl = 0; pl < 4; pl++ ) @@ -202,9 +201,8 @@ } while ( v6 >= pIcons_LOD->pFacesLock ); } - v12 = pIcons_LOD->pFacesLock; pIcons_LOD->pFacesLock = 0; - pIcons_LOD->uNumLoadedFiles = v12; + pIcons_LOD->uNumLoadedFiles = pIcons_LOD->pFacesLock; } // 4ED498: using guessed type char byte_4ED498;