1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

update the memory address from ra95.exe to use for screen stretching

This commit is contained in:
iran 2013-06-26 11:19:12 +02:00
parent 4fa437a1b9
commit 79b83bcb7a
5 changed files with 29 additions and 35 deletions

View File

@ -1,6 +1,6 @@
CC=gcc
CFLAGS=-DHAVE_LIBPNG -Iinclude -Wall -Wl,--enable-stdcall-fixup -O3 -s
LIBS=lib/libpng14.a lib/libz.a -lgdi32 -lopengl32
LIBS=lib/libpng14.a lib/libz.a -lgdi32 -lopengl32 -lwinmm
all:
$(CC) $(CFLAGS) -shared -o ddraw.dll main.c mouse.c palette.c surface.c clipper.c render.c render_soft.c render_dummy.c screenshot.c ddraw.def $(LIBS)

View File

@ -1,2 +1,3 @@
0x00665F58 = InMovie
0x0065D7BC = IsVQA640
0x00607D78 = InMovie
0x0065D7BC = IsVQA640
0x00607D78 = ShouldStretch BYTE (added by 3.03p-iran)

BIN
ddraw.dll

Binary file not shown.

View File

@ -14,6 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <windows.h>
#include <stdio.h>
@ -86,12 +87,16 @@ DWORD WINAPI render_main(void)
}
glEnable(GL_TEXTURE_2D);
timeBeginPeriod(1);
while(ddraw->render.run && WaitForSingleObject(ddraw->render.sem, INFINITE) != WAIT_FAILED)
{
scale_w = (float)ddraw->width/tex_width;
scale_h = (float)ddraw->height/tex_height;
scale_w = (float)ddraw->width/tex_width;
scale_h = (float)ddraw->height/tex_height;
if(ddraw->render.maxfps > 0)
{
tick_start = GetTickCount();
@ -144,22 +149,23 @@ DWORD WINAPI render_main(void)
glTexCoord2f(scale_w,scale_h); glVertex2f( 1, -1);
glTexCoord2f(0,scale_h); glVertex2f(-1, -1);
glEnd();
SwapBuffers(ddraw->render.hDC);
SwapBuffers(ddraw->render.hDC);
if(ddraw->render.maxfps > 0)
{
tick_end = GetTickCount();
if(tick_end - tick_start < frame_len)
{
Sleep( frame_len - (tick_end - tick_start) );
if((ddraw->render.maxfps > 0))
{
tick_end = GetTickCount();
if(tick_end - tick_start < frame_len)
{
Sleep( frame_len - (tick_end - tick_start));
}
}
SetEvent(ddraw->render.ev);
}
timeEndPeriod(1);
HeapFree(GetProcessHeap(), 0, tex);
wglMakeCurrent(NULL, NULL);
@ -167,18 +173,3 @@ DWORD WINAPI render_main(void)
return 0;
}
//BOOL detect_cutscene()
//{
// if(ddraw->width <= CUTSCENE_WIDTH || ddraw->height <= CUTSCENE_HEIGHT)
// return FALSE;
//
// return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE;
//}
#define DECLARE_VAR(name, type, address) type name = address
//DECLARE_VAR(InMovie, int*, 0x00665F58);
//DECLARE_VAR(IsVQA640, int*, 0x0065D7BC);

View File

@ -30,7 +30,7 @@ static unsigned char getPixel(int x, int y)
int* InMovie = (int*)0x00665F58;
int* IsVQA640 = (int*)0x0065D7BC;
BYTE* ShouldStretch = (BYTE*)0x006ED235;
BYTE* ShouldStretch = (BYTE*)0x00607D78;
BOOL detect_cutscene()
{
@ -49,7 +49,6 @@ BOOL detect_cutscene()
return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE;
}
DWORD WINAPI render_soft_main(void)
{
PBITMAPINFO bmi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
@ -69,6 +68,8 @@ DWORD WINAPI render_soft_main(void)
DWORD tick_start = 0;
DWORD tick_end = 0;
DWORD frame_len = 0;
timeBeginPeriod(1);
if (ddraw->boxing)
{
@ -152,17 +153,18 @@ DWORD WINAPI render_soft_main(void)
LeaveCriticalSection(&ddraw->cs);
if(ddraw->render.maxfps > 0)
if((ddraw->render.maxfps > 0) && !detect_cutscene())
{
tick_end = GetTickCount();
if(tick_end - tick_start < frame_len)
{
Sleep( frame_len - (tick_end - tick_start) );
Sleep( frame_len - (tick_end - tick_start) + 1);
}
}
SetEvent(ddraw->render.ev);
}
timeEndPeriod(1);
HeapFree(GetProcessHeap(), 0, bmi);