From ff17260e083bdf4461154b916a716cd9b61126b1 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sat, 12 Oct 2019 23:26:16 +0300 Subject: [PATCH] fix stub system driver and some warnings --- src/engine/e_graphics.pas | 2 ++ src/game/g_main.pas | 6 ++---- src/game/g_options.pas | 1 - src/game/g_window.pas | 31 +++++++------------------------ src/game/sdl/g_system.pas | 2 +- src/game/stub/g_system.pas | 5 ++++- src/nogl/noGLES1.inc | 13 ++++++------- src/shared/xprofiler.pas | 10 +--------- 8 files changed, 23 insertions(+), 47 deletions(-) diff --git a/src/engine/e_graphics.pas b/src/engine/e_graphics.pas index 6f1df29..ca6dcf1 100644 --- a/src/engine/e_graphics.pas +++ b/src/engine/e_graphics.pas @@ -1504,8 +1504,10 @@ end; procedure e_TextureFontBuild(Tex: DWORD; var FontID: DWORD; XCount, YCount: Word; Space: ShortInt=0); var +{$IF not DEFINED(USE_NANOGL) and not DEFINED(USE_NOGL)} loop1 : GLuint; cx, cy : real; +{$ENDIF} i, id: DWORD; begin if e_NoGraphics then Exit; diff --git a/src/game/g_main.pas b/src/game/g_main.pas index 6a6df2a..0269a4c 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -53,10 +53,8 @@ var charbuff: packed array [0..15] of AnsiChar; procedure Main(); -var - sdlflags: LongWord; -{$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)} - flexloaded: Boolean; +{$IFDEF ENABLE_HOLMES} + var flexloaded: Boolean; {$ENDIF} begin e_InitWritelnDriver(); diff --git a/src/game/g_options.pas b/src/game/g_options.pas index f889ea3..116e647 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -182,7 +182,6 @@ end; {$ELSE} procedure g_Options_SetDefaultVideo; begin - {$WARNING stub} gScreenWidth := 640; gScreenHeight := 480; gBPP := 32; diff --git a/src/game/g_window.pas b/src/game/g_window.pas index 002e51a..3ea192b 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -55,8 +55,6 @@ var flag: Boolean; wNeedTimeReset: Boolean = false; wMinimized: Boolean = false; - wMaximized: Boolean = false; - wLoadingProgress: Boolean = false; wLoadingQuit: Boolean = false; procedure ResetTimer (); @@ -70,27 +68,13 @@ var {$ENDIF} procedure ProcessLoading (forceUpdate: Boolean=false); -var {$IFNDEF HEADLESS} -// ev: TSDL_Event; +var stt: UInt64; {$ENDIF} begin -// FillChar(ev, sizeof(ev), 0); - wLoadingProgress := true; - -// while (SDL_PollEvent(@ev) > 0) do -// begin -// EventHandler(ev); -// if (ev.type_ = SDL_QUITEV) then break; -// end; - //e_PollJoysticks(); - -// if (ev.type_ = SDL_QUITEV) or (gExit = EXIT_QUIT) then -// begin -// wLoadingProgress := false; -// exit; -// end; + if sys_HandleInput() = True then + Exit; {$IFNDEF HEADLESS} if not wMinimized then @@ -124,8 +108,6 @@ begin begin if (NetMode = NET_CLIENT) and (NetState <> NET_STATE_AUTH) then g_Net_Client_UpdateWhileLoading(); end; - - wLoadingProgress := false; end; @@ -246,9 +228,6 @@ end; function SDLMain (): Integer; var idx: Integer; - {$IF not DEFINED(HEADLESS)} - ltmp: Integer; - {$ENDIF} arg: AnsiString; mdfo: TStream; {$IFDEF ENABLE_HOLMES} @@ -343,8 +322,12 @@ begin end; end; +{$IFDEF USE_SYSSTUB} PrintGLSupportedExtensions; glLegacyNPOT := GLExtensionSupported('GL_ARB_texture_non_power_of_two') or GLExtensionSupported('GL_OES_texture_npot'); +{$ELSE} + glLegacyNPOT := False; +{$ENDIF} e_logWritefln('NPOT textures: %s', [glLegacyNPOT]); gwin_dump_extensions := false; diff --git a/src/game/sdl/g_system.pas b/src/game/sdl/g_system.pas index 4a4a3cb..3e78fad 100644 --- a/src/game/sdl/g_system.pas +++ b/src/game/sdl/g_system.pas @@ -142,7 +142,7 @@ implementation f.BitsPerPixel := bpp; f.BytesPerPixel := (bpp + 7) div 8; m := SDL_ListModes(@f, SDL_OPENGL or SDL_FULLSCREEN); - if (m <> NIL) and (IntPtr(m) <> -1) then + if (m <> NIL) and (UIntPtr(m) <> UIntPtr(-1)) then begin count := 0; while m[count] <> nil do inc(count); diff --git a/src/game/stub/g_system.pas b/src/game/stub/g_system.pas index 4e9fced..4b6201d 100644 --- a/src/game/stub/g_system.pas +++ b/src/game/stub/g_system.pas @@ -39,15 +39,18 @@ interface implementation + uses SysUtils; + (* --------- Utils --------- *) function sys_GetTicks (): Int64; begin - Result := 0 + Result := Round(TimeStampToMSecs(DateTimeToTimeStamp(Now()))) end; procedure sys_Delay (ms: Integer); begin + Sleep(ms) end; (* --------- Graphics --------- *) diff --git a/src/nogl/noGLES1.inc b/src/nogl/noGLES1.inc index a4c6589..1f4f67a 100644 --- a/src/nogl/noGLES1.inc +++ b/src/nogl/noGLES1.inc @@ -35,8 +35,8 @@ implementation es_glEnableClientState: procedure (arr: GLenum); cdecl; es_glDisableClientState: procedure (arr: GLenum); cdecl; es_glDrawArrays: procedure (mode: GLenum; first: GLint; count: GLsizei); cdecl; - es_glActiveTexture: procedure(texture: GLenum); cdecl; - es_glClientActiveTexture: procedure(texture: GLenum); cdecl; +// es_glActiveTexture: procedure(texture: GLenum); cdecl; +// es_glClientActiveTexture: procedure(texture: GLenum); cdecl; es_glColor4f: procedure(red, green, blue, alpha: GLfloat); cdecl; es_glEnable: procedure (cap: GLenum); cdecl; @@ -160,7 +160,6 @@ implementation end; procedure glEnd; - var count: Integer; begin assert(cmds.mode <> GL_INVALID_ENUM); assert(Length(cmds.v) mod ValPerVertex = 0); @@ -414,8 +413,8 @@ implementation es_glEnableClientState := SDL_GL_GetProcAddress('glEnableClientState'); es_glDisableClientState := SDL_GL_GetProcAddress('glDisableClientState'); es_glDrawArrays := SDL_GL_GetProcAddress('glDrawArrays'); - es_glActiveTexture := SDL_GL_GetProcAddress('glActiveTexture'); - es_glClientActiveTexture := SDL_GL_GetProcAddress('glClientActiveTexture'); +// es_glActiveTexture := SDL_GL_GetProcAddress('glActiveTexture'); +// es_glClientActiveTexture := SDL_GL_GetProcAddress('glClientActiveTexture'); es_glColor4f := SDL_GL_GetProcAddress('glColor4f'); es_glEnable := SDL_GL_GetProcAddress('glEnable'); @@ -470,8 +469,8 @@ implementation es_glEnableClientState := nil; es_glDisableClientState := nil; es_glDrawArrays := nil; - es_glActiveTexture := nil; - es_glClientActiveTexture := nil; +// es_glActiveTexture := nil; +// es_glClientActiveTexture := nil; es_glColor4f := nil; es_glEnable := nil; diff --git a/src/shared/xprofiler.pas b/src/shared/xprofiler.pas index 5e6212b..9e25bdb 100644 --- a/src/shared/xprofiler.pas +++ b/src/shared/xprofiler.pas @@ -227,14 +227,6 @@ begin result := UInt64(r)*1000000 div mFrequency; {$ENDIF} end; -(* !!! -{$ELSEIF DEFINED(USE_SDL)} -function getTimeMicro: UInt64; inline; -begin - {$WARNING use inaccurate profiling timer} - result := SDL_GetTicks() * 1000 -end; -*) {$ELSEIF DEFINED(USE_SDL2)} function getTimeMicro (): UInt64; inline; begin @@ -243,7 +235,7 @@ end; {$ELSE} function getTimeMicro: UInt64; inline; begin - {$WARNING use stub profiling timer} + result := Round(TimeStampToMSecs(DateTimeToTimeStamp(Now())) * 1000); end; {$ENDIF} -- 2.29.2