mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
- moved Windows platform code as well.
This commit is contained in:
parent
0b544f2956
commit
f8e23500c7
43 changed files with 255 additions and 40 deletions
|
@ -438,28 +438,28 @@ endif()
|
|||
|
||||
# Start defining source files for ZDoom
|
||||
set( PLAT_WIN32_SOURCES
|
||||
win32/hardware.cpp
|
||||
win32/i_crash.cpp
|
||||
win32/i_input.cpp
|
||||
win32/i_keyboard.cpp
|
||||
win32/i_mouse.cpp
|
||||
win32/i_dijoy.cpp
|
||||
win32/i_rawps2.cpp
|
||||
win32/i_xinput.cpp
|
||||
win32/i_main.cpp
|
||||
win32/i_steam.cpp
|
||||
win32/i_system.cpp
|
||||
win32/i_specialpaths.cpp
|
||||
win32/st_start.cpp
|
||||
win32/st_start_util.cpp
|
||||
win32/gl_sysfb.cpp
|
||||
win32/base_sysfb.cpp
|
||||
win32/win32basevideo.cpp
|
||||
win32/win32glvideo.cpp
|
||||
win32/win32polyvideo.cpp)
|
||||
common/platform/win32/hardware.cpp
|
||||
common/platform/win32/i_crash.cpp
|
||||
common/platform/win32/i_input.cpp
|
||||
common/platform/win32/i_keyboard.cpp
|
||||
common/platform/win32/i_mouse.cpp
|
||||
common/platform/win32/i_dijoy.cpp
|
||||
common/platform/win32/i_rawps2.cpp
|
||||
common/platform/win32/i_xinput.cpp
|
||||
common/platform/win32/i_main.cpp
|
||||
common/platform/win32/i_system.cpp
|
||||
common/platform/win32/i_specialpaths.cpp
|
||||
common/platform/win32/st_start.cpp
|
||||
common/platform/win32/st_start_util.cpp
|
||||
common/platform/win32/gl_sysfb.cpp
|
||||
common/platform/win32/base_sysfb.cpp
|
||||
common/platform/win32/win32basevideo.cpp
|
||||
common/platform/win32/win32glvideo.cpp
|
||||
common/platform/win32/win32polyvideo.cpp)
|
||||
|
||||
if (HAVE_VULKAN)
|
||||
set (PLAT_WIN32_SOURCES ${PLAT_WIN32_SOURCES} win32/win32vulkanvideo.cpp )
|
||||
set (PLAT_WIN32_SOURCES ${PLAT_WIN32_SOURCES} common/platform/win32/win32vulkanvideo.cpp )
|
||||
endif()
|
||||
|
||||
set( PLAT_POSIX_SOURCES
|
||||
|
@ -492,7 +492,7 @@ set( PLAT_COCOA_SOURCES
|
|||
common/platform/posix/cocoa/st_start.mm )
|
||||
|
||||
if( WIN32 )
|
||||
set( SYSTEM_SOURCES_DIR win32 )
|
||||
set( SYSTEM_SOURCES_DIR common/platform/win32 )
|
||||
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
|
||||
|
@ -594,7 +594,6 @@ file( GLOB HEADER_FILES
|
|||
sound/*.h
|
||||
sound/backend/*.h*
|
||||
posix/*.h
|
||||
win32/*.h
|
||||
r_data/*.h
|
||||
r_data/models/*.h
|
||||
common/audio/sound/thirdparty/*.h
|
||||
|
@ -610,6 +609,7 @@ file( GLOB HEADER_FILES
|
|||
common/filesystem/*.h
|
||||
common/platform/posix/cocoa/*.h
|
||||
common/platform/posix/sdl/*.h
|
||||
common/platform/win32/*.h
|
||||
common/textures/*.h
|
||||
common/textures/hires/hqnx/*.h
|
||||
common/textures/hires/hqnx_asm/*.h
|
||||
|
@ -738,7 +738,7 @@ set( NOT_COMPILED_SOURCE_FILES
|
|||
common/scripting/frontend/zcc-parse.lemon
|
||||
zcc-parse.c
|
||||
zcc-parse.h
|
||||
win32/zdoom.natvis
|
||||
common/platform/win32/zutil.natvis
|
||||
)
|
||||
|
||||
set( VM_JIT_SOURCES
|
||||
|
@ -1321,7 +1321,7 @@ if( MSVC )
|
|||
set_target_properties(zdoom PROPERTIES LINK_FLAGS ${LINKERSTUFF})
|
||||
|
||||
add_custom_command(TARGET zdoom POST_BUILD
|
||||
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$<TARGET_FILE:zdoom>\"\;\#1
|
||||
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\common\\platform\\win32\\manifest.xml\" -outputresource:\"$<TARGET_FILE:zdoom>\"\;\#1
|
||||
COMMENT "Adding manifest..."
|
||||
)
|
||||
|
||||
|
@ -1470,6 +1470,7 @@ source_group("Common\\Platforms\\Cocoa Files" REGULAR_EXPRESSION "^${CMAKE_CURRE
|
|||
source_group("Common\\Platforms\\OS X Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/osx/.+")
|
||||
source_group("Common\\Platforms\\Unix Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/unix/.+")
|
||||
source_group("Common\\Platforms\\SDL Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/posix/sdl/.+")
|
||||
source_group("Common\\Platforms\\Win32 Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/platform/win32/.+")
|
||||
source_group("Common\\Rendering" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/.+")
|
||||
source_group("Common\\Rendering\\OpenGL Loader" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/rendering/gl_load/.+")
|
||||
source_group("Common\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/.+")
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include "i_interface.h"
|
||||
|
||||
// Some global engine variables taken out of the backend code.
|
||||
SystemCallbacks *sysCallbacks;
|
||||
double refreshfreq;
|
||||
FString endoomName;
|
||||
bool batchrun;
|
||||
|
||||
|
|
|
@ -23,3 +23,4 @@ struct WadStuff
|
|||
|
||||
|
||||
extern FString endoomName;
|
||||
extern bool batchrun;
|
||||
|
|
207
src/common/engine/st_start.h
Normal file
207
src/common/engine/st_start.h
Normal file
|
@ -0,0 +1,207 @@
|
|||
#pragma once
|
||||
/*
|
||||
** st_start.h
|
||||
** Interface for the startup screen.
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2006-2007 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
** The startup screen interface is based on a mix of Heretic and Hexen.
|
||||
** Actual implementation is system-specific.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
class FStartupScreen
|
||||
{
|
||||
public:
|
||||
static FStartupScreen *CreateInstance(int max_progress);
|
||||
|
||||
FStartupScreen(int max_progress)
|
||||
{
|
||||
MaxPos = max_progress;
|
||||
CurPos = 0;
|
||||
NotchPos = 0;
|
||||
}
|
||||
|
||||
virtual ~FStartupScreen() = default;
|
||||
|
||||
virtual void Progress() {}
|
||||
|
||||
virtual void NetInit(const char *message, int num_players) {}
|
||||
virtual void NetProgress(int count) {}
|
||||
virtual void NetMessage(const char *format, ...) {} // cover for printf
|
||||
virtual void NetDone() {}
|
||||
virtual bool NetLoop(bool (*timer_callback)(void *), void *userdata) { return false; }
|
||||
protected:
|
||||
int MaxPos, CurPos, NotchPos;
|
||||
};
|
||||
|
||||
class FBasicStartupScreen : public FStartupScreen
|
||||
{
|
||||
public:
|
||||
FBasicStartupScreen(int max_progress, bool show_bar);
|
||||
~FBasicStartupScreen();
|
||||
|
||||
void Progress();
|
||||
void NetInit(const char* message, int num_players);
|
||||
void NetProgress(int count);
|
||||
void NetMessage(const char* format, ...); // cover for printf
|
||||
void NetDone();
|
||||
bool NetLoop(bool (*timer_callback)(void*), void* userdata);
|
||||
protected:
|
||||
long long NetMarqueeMode;
|
||||
int NetMaxPos, NetCurPos;
|
||||
};
|
||||
|
||||
class FGraphicalStartupScreen : public FBasicStartupScreen
|
||||
{
|
||||
public:
|
||||
FGraphicalStartupScreen(int max_progress);
|
||||
~FGraphicalStartupScreen();
|
||||
};
|
||||
|
||||
class FHereticStartupScreen : public FGraphicalStartupScreen
|
||||
{
|
||||
public:
|
||||
FHereticStartupScreen(int max_progress, long &hr);
|
||||
|
||||
void Progress();
|
||||
void LoadingStatus(const char *message, int colors);
|
||||
void AppendStatusLine(const char *status);
|
||||
protected:
|
||||
void SetWindowSize();
|
||||
|
||||
int ThermX, ThermY, ThermWidth, ThermHeight;
|
||||
int HMsgY, SMsgX;
|
||||
};
|
||||
|
||||
class FHexenStartupScreen : public FGraphicalStartupScreen
|
||||
{
|
||||
public:
|
||||
FHexenStartupScreen(int max_progress, long &hr);
|
||||
~FHexenStartupScreen();
|
||||
|
||||
void Progress();
|
||||
void NetProgress(int count);
|
||||
void NetDone();
|
||||
void SetWindowSize();
|
||||
|
||||
// Hexen's notch graphics, converted to chunky pixels.
|
||||
uint8_t * NotchBits;
|
||||
uint8_t * NetNotchBits;
|
||||
};
|
||||
|
||||
class FStrifeStartupScreen : public FGraphicalStartupScreen
|
||||
{
|
||||
public:
|
||||
FStrifeStartupScreen(int max_progress, long &hr);
|
||||
~FStrifeStartupScreen();
|
||||
|
||||
void Progress();
|
||||
protected:
|
||||
void DrawStuff(int old_laser, int new_laser);
|
||||
void SetWindowSize();
|
||||
|
||||
uint8_t *StartupPics[4+2+1];
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern FStartupScreen *StartScreen;
|
||||
|
||||
void DeleteStartupScreen();
|
||||
extern void ST_Endoom();
|
||||
|
||||
// The entire set of functions here uses native Windows types. These are recreations of those types so that the code doesn't need to be changed more than necessary
|
||||
|
||||
struct BitmapInfoHeader
|
||||
{
|
||||
uint32_t biSize;
|
||||
int32_t biWidth;
|
||||
int32_t biHeight;
|
||||
uint16_t biPlanes;
|
||||
uint16_t biBitCount;
|
||||
uint32_t biCompression;
|
||||
uint32_t biSizeImage;
|
||||
int32_t biXPelsPerMeter;
|
||||
int32_t biYPelsPerMeter;
|
||||
uint32_t biClrUsed;
|
||||
uint32_t biClrImportant;
|
||||
};
|
||||
|
||||
struct RgbQuad
|
||||
{
|
||||
uint8_t rgbBlue;
|
||||
uint8_t rgbGreen;
|
||||
uint8_t rgbRed;
|
||||
uint8_t rgbReserved;
|
||||
};
|
||||
|
||||
|
||||
struct BitmapInfo
|
||||
{
|
||||
BitmapInfoHeader bmiHeader;
|
||||
RgbQuad bmiColors[1];
|
||||
};
|
||||
|
||||
extern BitmapInfo* StartupBitmap;
|
||||
|
||||
|
||||
void ST_Util_PlanarToChunky4(uint8_t* dest, const uint8_t* src, int width, int height);
|
||||
void ST_Util_DrawBlock(BitmapInfo* bitmap_info, const uint8_t* src, int x, int y, int bytewidth, int height);
|
||||
void ST_Util_ClearBlock(BitmapInfo* bitmap_info, uint8_t fill, int x, int y, int bytewidth, int height);
|
||||
BitmapInfo* ST_Util_CreateBitmap(int width, int height, int color_bits);
|
||||
uint8_t* ST_Util_BitsForBitmap(BitmapInfo* bitmap_info);
|
||||
void ST_Util_FreeBitmap(BitmapInfo* bitmap_info);
|
||||
void ST_Util_BitmapColorsFromPlaypal(BitmapInfo* bitmap_info);
|
||||
uint8_t* ST_Util_LoadFont(const char* filename);
|
||||
void ST_Util_FreeFont(uint8_t* font);
|
||||
BitmapInfo* ST_Util_AllocTextBitmap(const uint8_t* font);
|
||||
void ST_Util_DrawTextScreen(BitmapInfo* bitmap_info, const uint8_t* text_screen, const uint8_t* font);
|
||||
void ST_Util_DrawChar(BitmapInfo* screen, const uint8_t* font, int x, int y, uint8_t charnum, uint8_t attrib);
|
||||
void ST_Util_UpdateTextBlink(BitmapInfo* bitmap_info, const uint8_t* text_screen, const uint8_t* font, bool on);
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// DeleteStartupScreen
|
||||
//
|
||||
// Makes sure the startup screen has been deleted before quitting.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
inline void DeleteStartupScreen()
|
||||
{
|
||||
if (StartScreen != nullptr)
|
||||
{
|
||||
delete StartScreen;
|
||||
StartScreen = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -12,6 +12,7 @@ struct FStartupInfo
|
|||
int Type;
|
||||
int LoadLights = -1;
|
||||
int LoadBrightmaps = -1;
|
||||
int modern = -1;
|
||||
enum
|
||||
{
|
||||
DefaultStartup,
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include "st_start.h"
|
||||
#include "i_interface.h"
|
||||
#include "startupinfo.h"
|
||||
#include "printf.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
#ifndef __I_SYSTEM__
|
||||
#define __I_SYSTEM__
|
||||
|
|
@ -38,10 +38,11 @@
|
|||
#include "st_start.h"
|
||||
#include "m_alloc.h"
|
||||
#include "filesystem.h"
|
||||
#include "v_palette.h"
|
||||
#include "s_sound.h"
|
||||
#include "s_soundinternal.h"
|
||||
#include "s_music.h"
|
||||
#include "d_main.h"
|
||||
#include "startupinfo.h"
|
||||
#include "palutil.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
void I_GetEvent(); // i_input.h pulls in too much garbage.
|
||||
|
||||
|
@ -393,6 +394,11 @@ static const int StrifeStartupPicSizes[4 + 2 + 1] =
|
|||
};
|
||||
|
||||
|
||||
static void ST_Sound(const char* sndname)
|
||||
{
|
||||
//S_Sound(CHAN_BODY, 0, sndname, 1, ATTN_NONE);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FHexenStartupScreen Constructor
|
||||
|
@ -511,7 +517,7 @@ void FHexenStartupScreen::Progress()
|
|||
y = ST_PROGRESS_Y;
|
||||
ST_Util_DrawBlock(StartupBitmap, NotchBits, x, y, ST_NOTCH_WIDTH / 2, ST_NOTCH_HEIGHT);
|
||||
}
|
||||
S_Sound(CHAN_BODY, 0, "StartupTick", 1, ATTN_NONE);
|
||||
ST_Sound("StartupTick");
|
||||
}
|
||||
}
|
||||
I_GetEvent();
|
||||
|
@ -539,7 +545,7 @@ void FHexenStartupScreen::NetProgress(int count)
|
|||
y = ST_NETPROGRESS_Y;
|
||||
ST_Util_DrawBlock(StartupBitmap, NetNotchBits, x, y, ST_NETNOTCH_WIDTH / 2, ST_NETNOTCH_HEIGHT);
|
||||
}
|
||||
S_Sound(CHAN_BODY, 0, "misc/netnotch", 1, ATTN_NONE);
|
||||
ST_Sound("misc/netnotch");
|
||||
I_GetEvent();
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +560,7 @@ void FHexenStartupScreen::NetProgress(int count)
|
|||
|
||||
void FHexenStartupScreen::NetDone()
|
||||
{
|
||||
S_Sound(CHAN_BODY, 0, "PickupWeapon", 1, ATTN_NORM);
|
||||
ST_Sound("PickupWeapon");
|
||||
FGraphicalStartupScreen::NetDone();
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
#include "engineerrors.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#ifdef HAVE_SOFTPOLY
|
||||
|
||||
EXTERN_CVAR(Bool, vid_vsync)
|
||||
|
||||
bool ViewportLinearScale();
|
||||
|
@ -193,3 +195,5 @@ void I_PolyPresentDeinit()
|
|||
if (device) device->Release();
|
||||
if (d3d9) d3d9->Release();
|
||||
}
|
||||
|
||||
#endif
|
|
@ -282,7 +282,6 @@ bool nospriterename;
|
|||
FStartupInfo GameStartupInfo;
|
||||
FString lastIWAD;
|
||||
int restart = 0;
|
||||
bool batchrun; // just run the startup and collect all error messages in a logfile, then quit without any interaction
|
||||
bool AppActive = true;
|
||||
|
||||
cycle_t FrameCycles;
|
||||
|
@ -3398,8 +3397,6 @@ static int D_DoomMain_Internal (void)
|
|||
while (1);
|
||||
}
|
||||
|
||||
void I_ShowFatalError(const char* message);
|
||||
|
||||
int GameMain()
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "m_png.h"
|
||||
#include "templates.h"
|
||||
#include "r_videoscale.h"
|
||||
#include "actor.h"
|
||||
#include "i_time.h"
|
||||
#include "g_game.h"
|
||||
#include "v_text.h"
|
||||
|
|
|
@ -59,12 +59,10 @@
|
|||
#include <wincrypt.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include "hardware.h"
|
||||
#include "printf.h"
|
||||
|
||||
#include "version.h"
|
||||
#include "i_sound.h"
|
||||
#include "resource.h"
|
||||
#include "stats.h"
|
||||
#include "v_text.h"
|
||||
#include "utf8.h"
|
||||
|
@ -72,14 +70,12 @@
|
|||
#include "d_main.h"
|
||||
#include "d_net.h"
|
||||
#include "g_game.h"
|
||||
#include "i_input.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "templates.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "v_font.h"
|
||||
#include "g_level.h"
|
||||
#include "doomstat.h"
|
||||
#include "i_system.h"
|
||||
#include "bitmap.h"
|
||||
#include "cmdlib.h"
|
||||
#include "i_interface.h"
|
||||
|
|
|
@ -313,7 +313,7 @@ END
|
|||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#ifndef NO_MANIFEST
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "zdoom.exe.manifest"
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "..\\common\\platform\\win32\\manifest.xml"
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue