mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Merge branch 'master' into decideaction
This commit is contained in:
+23
-59
@@ -154,7 +154,7 @@ jobs:
|
|||||||
cat dist/versions.env
|
cat dist/versions.env
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: versions.env
|
name: versions.env
|
||||||
path: dist/
|
path: dist/
|
||||||
@@ -179,77 +179,41 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: dist
|
||||||
|
pattern: '*_release'
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Move release archives to dist/
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -eux
|
|
||||||
mkdir dist/
|
|
||||||
mv artifacts/*_release/* dist/
|
|
||||||
|
|
||||||
- name: Delete Latest Release and Tag
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
uses: dev-drprasad/delete-tag-and-release@v1.0
|
|
||||||
with:
|
|
||||||
delete_release: true
|
|
||||||
tag_name: "latest"
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: source
|
path: source
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
sparse-checkout: 'README.md'
|
sparse-checkout: 'README.md'
|
||||||
- name: Create Latest Tag
|
- name: Create latest pre-release
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
working-directory: source
|
working-directory: source
|
||||||
run: |
|
run: |
|
||||||
|
gh release delete latest --cleanup-tag || true
|
||||||
git tag -d latest || true
|
git tag -d latest || true
|
||||||
|
git push --delete origin refs/tags/latest || true
|
||||||
git tag latest
|
git tag latest
|
||||||
git push origin latest
|
git push --force origin refs/tags/latest
|
||||||
- id: release_latest
|
gh release create latest ../dist/* \
|
||||||
name: Release Latest
|
--generate-notes \
|
||||||
if: github.ref == 'refs/heads/master'
|
--title "Latest (unstable)" \
|
||||||
uses: ncipollo/release-action@v1
|
--verify-tag \
|
||||||
with:
|
--prerelease
|
||||||
artifactErrorsFailBuild: true
|
env:
|
||||||
artifacts: dist/*
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
generateReleaseNotes: true
|
|
||||||
makeLatest: true
|
|
||||||
name: "Latest (unstable)"
|
|
||||||
prerelease: true
|
|
||||||
tag: "latest"
|
|
||||||
|
|
||||||
- id: release_tag
|
- name: Upload to tagged release
|
||||||
name: Release Tag
|
|
||||||
uses: ncipollo/release-action@v1
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
with:
|
working-directory: source
|
||||||
allowUpdates: true
|
|
||||||
artifactErrorsFailBuild: true
|
|
||||||
artifacts: dist/*
|
|
||||||
draft: false
|
|
||||||
generateReleaseNotes: true
|
|
||||||
makeLatest: true
|
|
||||||
omitBodyDuringUpdate: true
|
|
||||||
omitDraftDuringUpdate: true
|
|
||||||
omitNameDuringUpdate: true
|
|
||||||
omitPrereleaseDuringUpdate: true
|
|
||||||
|
|
||||||
- name: Show release outputs
|
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
echo 'id: '
|
exit 0
|
||||||
echo -n '${{ steps.release_tag.outputs.id }}'
|
gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber
|
||||||
echo -n '${{ steps.release_latest.outputs.id }}'
|
env:
|
||||||
echo ''
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
echo ''
|
|
||||||
echo 'url:'
|
|
||||||
echo -n '${{ steps.release_tag.outputs.html_url }}'
|
|
||||||
echo -n '${{ steps.release_latest.outputs.html_url }}'
|
|
||||||
echo ''
|
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source
|
- name: Checkout source
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download versions.env
|
- name: Download versions.env
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: versions.env
|
name: versions.env
|
||||||
path: artifacts
|
path: artifacts
|
||||||
@@ -41,6 +41,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: cat artifacts/versions.env >> $GITHUB_ENV
|
run: cat artifacts/versions.env >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# TODO: Move this into CMake, just taking the GitHub Actions parameters as -D variables
|
||||||
- name: Update GameVersion.cpp
|
- name: Update GameVersion.cpp
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -49,9 +50,9 @@ jobs:
|
|||||||
GAME_VERSION=$(echo "$GAME_VERSION" | tr -cd '[:print:]' | tr -d '"\\')
|
GAME_VERSION=$(echo "$GAME_VERSION" | tr -cd '[:print:]' | tr -d '"\\')
|
||||||
GAME_BUILD="${INPUTS_LANGUAGE:0:2} $GAME_BUILD_INFORMATION"
|
GAME_BUILD="${INPUTS_LANGUAGE:0:2} $GAME_BUILD_INFORMATION"
|
||||||
GAME_BUILD=$(echo "$GAME_BUILD" | tr -cd '[:print:]' | tr -d '"\\')
|
GAME_BUILD=$(echo "$GAME_BUILD" | tr -cd '[:print:]' | tr -d '"\\')
|
||||||
sed -i "s|@Version@|${GAME_VERSION:0:15}|" GameVersion.cpp
|
sed -i "s|@Version@|${GAME_VERSION:0:15}|" Ja2/GameVersion.cpp
|
||||||
sed -i "s|@Build@|${GAME_BUILD:0:255}|" GameVersion.cpp
|
sed -i "s|@Build@|${GAME_BUILD:0:255}|" Ja2/GameVersion.cpp
|
||||||
cat GameVersion.cpp
|
cat Ja2/GameVersion.cpp
|
||||||
|
|
||||||
- name: Prepare build properties
|
- name: Prepare build properties
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -68,7 +69,7 @@ jobs:
|
|||||||
JA2Application=$JA2Application
|
JA2Application=$JA2Application
|
||||||
" >> $GITHUB_ENV
|
" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: microsoft/setup-msbuild@v1.1
|
- uses: microsoft/setup-msbuild@v2
|
||||||
with:
|
with:
|
||||||
msbuild-architecture: x86
|
msbuild-architecture: x86
|
||||||
- uses: ilammy/msvc-dev-cmd@v1
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
@@ -86,7 +87,7 @@ jobs:
|
|||||||
find build/
|
find build/
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.language }}_${{ matrix.application }}
|
name: ${{ inputs.language }}_${{ matrix.application }}
|
||||||
path: build/*.exe
|
path: build/*.exe
|
||||||
@@ -99,7 +100,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download versions.env
|
- name: Download versions.env
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: versions.env
|
name: versions.env
|
||||||
path: artifacts
|
path: artifacts
|
||||||
@@ -108,7 +109,7 @@ jobs:
|
|||||||
run: cat artifacts/versions.env >> $GITHUB_ENV
|
run: cat artifacts/versions.env >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Checkout gamedir
|
- name: Checkout gamedir
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: ${{ env.GAMEDIR_REPOSITORY }}
|
repository: ${{ env.GAMEDIR_REPOSITORY }}
|
||||||
ref: ${{ env.GAMEDIR_COMMIT_SHA }}
|
ref: ${{ env.GAMEDIR_COMMIT_SHA }}
|
||||||
@@ -116,7 +117,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout gamedir-languages
|
- name: Checkout gamedir-languages
|
||||||
if: inputs.language != 'English'
|
if: inputs.language != 'English'
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }}
|
repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }}
|
||||||
ref: ${{ env.GAMEDIR_LANGUAGES_COMMIT_SHA }}
|
ref: ${{ env.GAMEDIR_LANGUAGES_COMMIT_SHA }}
|
||||||
@@ -130,25 +131,25 @@ jobs:
|
|||||||
cp -a gamedir-languages/${{ inputs.language }}_Version/* gamedir/
|
cp -a gamedir-languages/${{ inputs.language }}_Version/* gamedir/
|
||||||
|
|
||||||
- name: Download ja2
|
- name: Download ja2
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.language }}_ja2
|
name: ${{ inputs.language }}_ja2
|
||||||
path: artifacts/ja2
|
path: artifacts/ja2
|
||||||
|
|
||||||
- name: Download ja2mapeditor
|
- name: Download ja2mapeditor
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.language }}_ja2mapeditor
|
name: ${{ inputs.language }}_ja2mapeditor
|
||||||
path: artifacts/ja2mapeditor
|
path: artifacts/ja2mapeditor
|
||||||
|
|
||||||
- name: Download ja2ub
|
- name: Download ja2ub
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.language }}_ja2ub
|
name: ${{ inputs.language }}_ja2ub
|
||||||
path: artifacts/ja2ub
|
path: artifacts/ja2ub
|
||||||
|
|
||||||
- name: Download ja2ubmapeditor
|
- name: Download ja2ubmapeditor
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.language }}_ja2ubmapeditor
|
name: ${{ inputs.language }}_ja2ubmapeditor
|
||||||
path: artifacts/ja2ubmapeditor
|
path: artifacts/ja2ubmapeditor
|
||||||
@@ -198,7 +199,8 @@ jobs:
|
|||||||
7z a -bb -xr'!.*' "../dist/${DIST_NAME}.7z" .
|
7z a -bb -xr'!.*' "../dist/${DIST_NAME}.7z" .
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.language }}_release
|
name: ${{ inputs.language }}_release
|
||||||
path: dist/
|
path: dist/
|
||||||
|
compression-level: 0
|
||||||
|
|||||||
+12
-74
@@ -23,7 +23,7 @@ set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
|
|||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
|
||||||
add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE)
|
add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE)
|
||||||
include_directories(${CMAKE_SOURCE_DIR} "ext/VFS/include" Utils TileEngine TacticalAI ModularizedTacticalAI Tactical Strategic "Standard Gaming Platform" Res Lua Laptop Multiplayer "Multiplayer/raknet" Editor Console)
|
include_directories(Ja2 "ext/VFS/include" Utils TileEngine TacticalAI "ModularizedTacticalAI/include" Tactical Strategic sgp "Ja2/Res" Lua Laptop Multiplayer Editor Console)
|
||||||
|
|
||||||
# external libraries
|
# external libraries
|
||||||
add_subdirectory("ext/libpng")
|
add_subdirectory("ext/libpng")
|
||||||
@@ -38,90 +38,28 @@ add_subdirectory("ext/export/src")
|
|||||||
# by header files do not rely on Applications or Languages preprocessor definitions,
|
# by header files do not rely on Applications or Languages preprocessor definitions,
|
||||||
# and therefore only need to be compiled once. Good.
|
# and therefore only need to be compiled once. Good.
|
||||||
add_subdirectory(Lua)
|
add_subdirectory(Lua)
|
||||||
|
add_subdirectory(Multiplayer)
|
||||||
|
|
||||||
# static libraries whose source files, header files or header files included
|
# static libraries whose source files, header files or header files included
|
||||||
# by header files rely on Application and Language preprocessor definitions, and
|
# by header files rely on Application and Language preprocessor definitions, and
|
||||||
# therefore need to be compiled multiple times. Very Bad.
|
# therefore need to be compiled multiple times. Very Bad.
|
||||||
add_subdirectory(TileEngine)
|
|
||||||
add_subdirectory(TacticalAI)
|
|
||||||
add_subdirectory(Utils)
|
|
||||||
add_subdirectory(Strategic)
|
|
||||||
add_subdirectory("Standard Gaming Platform")
|
|
||||||
add_subdirectory(Laptop)
|
|
||||||
add_subdirectory(Editor)
|
|
||||||
add_subdirectory(Console)
|
|
||||||
add_subdirectory(Tactical)
|
|
||||||
add_subdirectory(ModularizedTacticalAI)
|
|
||||||
# TODO: Rename 'Standard Gaming Platform' directory to 'SGP' so this can be refactored away
|
|
||||||
set(Ja2_Libs
|
set(Ja2_Libs
|
||||||
TileEngine
|
TileEngine
|
||||||
TacticalAI
|
TacticalAI
|
||||||
Utils
|
Utils
|
||||||
Strategic
|
Strategic
|
||||||
SGP
|
sgp
|
||||||
Laptop
|
Laptop
|
||||||
Editor
|
Editor
|
||||||
Console
|
Console
|
||||||
Tactical
|
Tactical
|
||||||
ModularizedTacticalAI
|
ModularizedTacticalAI
|
||||||
)
|
)
|
||||||
|
foreach(lib IN LISTS Ja2_Libs)
|
||||||
|
add_subdirectory(${lib})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
# TODO: Move these units into their own directory to declutter the root dir and CMakeLists.txt file
|
add_subdirectory(Ja2)
|
||||||
set(Ja2Src
|
|
||||||
"aniviewscreen.cpp"
|
|
||||||
"Credits.cpp"
|
|
||||||
"Fade Screen.cpp"
|
|
||||||
"FeaturesScreen.cpp"
|
|
||||||
"GameInitOptionsScreen.cpp"
|
|
||||||
"gameloop.cpp"
|
|
||||||
"gamescreen.cpp"
|
|
||||||
"GameSettings.cpp"
|
|
||||||
"GameVersion.cpp"
|
|
||||||
"HelpScreen.cpp"
|
|
||||||
"Init.cpp"
|
|
||||||
"Intro.cpp"
|
|
||||||
"JA2 Splash.cpp"
|
|
||||||
"Ja25Update.cpp"
|
|
||||||
"jascreens.cpp"
|
|
||||||
"Language Defines.cpp"
|
|
||||||
"Loading Screen.cpp"
|
|
||||||
"MainMenuScreen.cpp"
|
|
||||||
"MessageBoxScreen.cpp"
|
|
||||||
"MPChatScreen.cpp"
|
|
||||||
"MPConnectScreen.cpp"
|
|
||||||
"MPHostScreen.cpp"
|
|
||||||
"MPJoinScreen.cpp"
|
|
||||||
"MPScoreScreen.cpp"
|
|
||||||
"MPXmlTeams.cpp"
|
|
||||||
"Multiplayer/client.cpp"
|
|
||||||
"Multiplayer/server.cpp"
|
|
||||||
"Multiplayer/transfer_rules.cpp"
|
|
||||||
"Options Screen.cpp"
|
|
||||||
"profiler.cpp"
|
|
||||||
"SaveLoadGame.cpp"
|
|
||||||
"SaveLoadScreen.cpp"
|
|
||||||
"SCREENS.cpp"
|
|
||||||
"Sys Globals.cpp"
|
|
||||||
"ub_config.cpp"
|
|
||||||
"XML_DifficultySettings.cpp"
|
|
||||||
"XML_IntroFiles.cpp"
|
|
||||||
"XML_Layout_MainMenu.cpp"
|
|
||||||
Res/ja2.rc
|
|
||||||
)
|
|
||||||
|
|
||||||
set(Ja2_Libraries
|
|
||||||
"${PROJECT_SOURCE_DIR}/libexpatMT.lib"
|
|
||||||
"Dbghelp.lib"
|
|
||||||
Lua
|
|
||||||
"${PROJECT_SOURCE_DIR}/lua51.lib"
|
|
||||||
"${PROJECT_SOURCE_DIR}/lua51.vc9.lib"
|
|
||||||
"Winmm.lib"
|
|
||||||
"${PROJECT_SOURCE_DIR}/SMACKW32.LIB"
|
|
||||||
"${PROJECT_SOURCE_DIR}/binkw32.lib"
|
|
||||||
bfVFS
|
|
||||||
"${PROJECT_SOURCE_DIR}/Multiplayer/raknet/RakNetLibStatic.lib"
|
|
||||||
"ws2_32.lib"
|
|
||||||
)
|
|
||||||
|
|
||||||
# simple function to validate Languages and Application choices
|
# simple function to validate Languages and Application choices
|
||||||
include(cmake/ValidateOptions.cmake)
|
include(cmake/ValidateOptions.cmake)
|
||||||
@@ -160,7 +98,7 @@ foreach(lang IN LISTS LangTargets)
|
|||||||
set(isUb $<STREQUAL:${exe},JA2UB>)
|
set(isUb $<STREQUAL:${exe},JA2UB>)
|
||||||
set(isUbEditor $<STREQUAL:${exe},JA2UBMAPEDITOR>)
|
set(isUbEditor $<STREQUAL:${exe},JA2UBMAPEDITOR>)
|
||||||
|
|
||||||
# static library for an app/lang combination, e.g. JA2_ENGLISH_SGP.lib
|
# static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib
|
||||||
add_library(${VeryBadLib})
|
add_library(${VeryBadLib})
|
||||||
target_sources(${VeryBadLib} PRIVATE ${${lib}Src})
|
target_sources(${VeryBadLib} PRIVATE ${${lib}Src})
|
||||||
|
|
||||||
@@ -174,9 +112,9 @@ foreach(lang IN LISTS LangTargets)
|
|||||||
target_link_libraries(${Executable} PUBLIC ${VeryBadLib})
|
target_link_libraries(${Executable} PUBLIC ${VeryBadLib})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# for SGP only
|
# for sgp only
|
||||||
target_link_libraries(${Executable}_SGP PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib")
|
target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib")
|
||||||
target_link_libraries(${Executable}_SGP PUBLIC libpng)
|
target_link_libraries(${Executable}_sgp PUBLIC libpng)
|
||||||
target_compile_definitions(${Executable}_SGP PRIVATE NO_ZLIB_COMPRESSION)
|
target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION)
|
||||||
endforeach()
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|||||||
+19
-9
@@ -79,8 +79,6 @@
|
|||||||
class OBJECTTYPE;
|
class OBJECTTYPE;
|
||||||
class SOLDIERTYPE;
|
class SOLDIERTYPE;
|
||||||
|
|
||||||
extern CHAR8 *szMusicList[NUM_MUSIC];
|
|
||||||
|
|
||||||
BOOLEAN gfCorruptMap = FALSE;
|
BOOLEAN gfCorruptMap = FALSE;
|
||||||
BOOLEAN gfCorruptSchedules = FALSE;
|
BOOLEAN gfCorruptSchedules = FALSE;
|
||||||
BOOLEAN gfProfileDataLoaded = FALSE;
|
BOOLEAN gfProfileDataLoaded = FALSE;
|
||||||
@@ -169,6 +167,7 @@ LEVELNODE *gCursorNode = NULL;
|
|||||||
INT32 gsCursorGridNo;
|
INT32 gsCursorGridNo;
|
||||||
|
|
||||||
INT32 giMusicID = 0;
|
INT32 giMusicID = 0;
|
||||||
|
NewMusicList gMusicMode = MUSICLIST_MAIN_MENU;
|
||||||
|
|
||||||
void EraseWorldData( );
|
void EraseWorldData( );
|
||||||
|
|
||||||
@@ -1616,16 +1615,27 @@ void HandleKeyboardShortcuts( )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case F4:
|
case F4:
|
||||||
#ifdef NEWMUSIC
|
MusicPlay(gMusicMode, giMusicID);
|
||||||
MusicPlay( giMusicID, MUSIC_OLD_TYPE, FALSE );
|
ScreenMsg( FONT_YELLOW, MSG_INTERFACE, L"%S", MusicLists[gMusicMode][giMusicID] );
|
||||||
#else
|
|
||||||
MusicPlay( giMusicID );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ScreenMsg( FONT_YELLOW, MSG_DEBUG, L"%S", szMusicList[giMusicID] );
|
// Select next track
|
||||||
giMusicID++;
|
giMusicID++;
|
||||||
if( giMusicID >= NUM_MUSIC )
|
if (giMusicID >= MusicLists[gMusicMode].size())
|
||||||
|
{
|
||||||
giMusicID = 0;
|
giMusicID = 0;
|
||||||
|
for (size_t i = 0; i < MAX_MUSIC; i++)
|
||||||
|
{
|
||||||
|
if (gMusicMode == i)
|
||||||
|
{
|
||||||
|
gMusicMode = static_cast<NewMusicList>(i + 1);
|
||||||
|
if (gMusicMode == MAX_MUSIC)
|
||||||
|
{
|
||||||
|
gMusicMode = MUSICLIST_MAIN_MENU;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F5:
|
case F5:
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#ifndef _JA2_DEMO_ADS_H
|
|
||||||
#define _JA2_DEMO_ADS_H
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#ifndef _JA2PROTOTYPES_H
|
|
||||||
#define _JA2PROTOTYPES_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This header does not define any structures. It simply provides a way for all code that only needs a pointer
|
|
||||||
* reference to structures, to have it without getting locked into mutual includes and other
|
|
||||||
* hard-to-trace-and-fix behavior. More class and struct defs can be added as necessary.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class SOLDIERTYPE;
|
|
||||||
struct AnimationSurfaceType;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
set(Ja2Src
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/aniviewscreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Credits.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Fade Screen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/FeaturesScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/GameInitOptionsScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/gameloop.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/gamescreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/GameSettings.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/GameVersion.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/HelpScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Init.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Intro.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Language Defines.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/MPChatScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/MPConnectScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/MPHostScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/MPJoinScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/MPScoreScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/MPXmlTeams.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Options Screen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/SCREENS.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp"
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc
|
||||||
|
PARENT_SCOPE)
|
||||||
|
|
||||||
|
set(Ja2_Libraries
|
||||||
|
"${CMAKE_SOURCE_DIR}/libexpatMT.lib"
|
||||||
|
"Dbghelp.lib"
|
||||||
|
Lua
|
||||||
|
"${CMAKE_SOURCE_DIR}/lua51.lib"
|
||||||
|
"${CMAKE_SOURCE_DIR}/lua51.vc9.lib"
|
||||||
|
"Winmm.lib"
|
||||||
|
"${CMAKE_SOURCE_DIR}/SMACKW32.LIB"
|
||||||
|
"${CMAKE_SOURCE_DIR}/binkw32.lib"
|
||||||
|
bfVFS
|
||||||
|
"ws2_32.lib"
|
||||||
|
Multiplayer
|
||||||
|
PARENT_SCOPE)
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "Animation Cache.h"
|
#include "Animation Cache.h"
|
||||||
#include "Animation Data.h"
|
#include "Animation Data.h"
|
||||||
#include "Animation Control.h"
|
#include "Animation Control.h"
|
||||||
#include "container.h"
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "pathai.h"
|
#include "pathai.h"
|
||||||
#include "Random.h"
|
#include "Random.h"
|
||||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -9683,21 +9683,6 @@ BOOLEAN SaveMeanwhileDefsFromSaveGameFile( HWFILE hFile )
|
|||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN DoesUserHaveEnoughHardDriveSpace()
|
|
||||||
{
|
|
||||||
UINT32 uiBytesFree=0;
|
|
||||||
|
|
||||||
uiBytesFree = GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( );
|
|
||||||
|
|
||||||
//check to see if there is enough hard drive space
|
|
||||||
if( uiBytesFree < REQUIRED_FREE_SPACE )
|
|
||||||
{
|
|
||||||
return( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
return( TRUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef JA2BETAVERSION
|
#ifdef JA2BETAVERSION
|
||||||
|
|
||||||
void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID )
|
void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID )
|
||||||
@@ -9961,69 +9946,6 @@ void UpdateMercMercContractInfo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave )
|
|
||||||
{
|
|
||||||
CHAR zFileName1[MAX_PATH];
|
|
||||||
CHAR zFileName2[MAX_PATH];
|
|
||||||
HWFILE hFile;
|
|
||||||
BOOLEAN fFile1Exist, fFile2Exist;
|
|
||||||
SGP_FILETIME CreationTime1, LastAccessedTime1, LastWriteTime1;
|
|
||||||
SGP_FILETIME CreationTime2, LastAccessedTime2, LastWriteTime2;
|
|
||||||
|
|
||||||
fFile1Exist = FALSE;
|
|
||||||
fFile2Exist = FALSE;
|
|
||||||
|
|
||||||
|
|
||||||
//The name of the file
|
|
||||||
sprintf( zFileName1, "%s\\Auto%02d.%S", gSaveDir, 0, pMessageStrings[ MSG_SAVEEXTENSION ] );
|
|
||||||
sprintf( zFileName2, "%s\\Auto%02d.%S", gSaveDir, 1, pMessageStrings[ MSG_SAVEEXTENSION ] );
|
|
||||||
|
|
||||||
if( FileExists( zFileName1 ) )
|
|
||||||
{
|
|
||||||
hFile = FileOpen( zFileName1, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
|
||||||
|
|
||||||
GetFileManFileTime( hFile, &CreationTime1, &LastAccessedTime1, &LastWriteTime1 );
|
|
||||||
|
|
||||||
FileClose( hFile );
|
|
||||||
|
|
||||||
fFile1Exist = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( FileExists( zFileName2 ) )
|
|
||||||
{
|
|
||||||
hFile = FileOpen( zFileName2, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
|
||||||
|
|
||||||
GetFileManFileTime( hFile, &CreationTime2, &LastAccessedTime2, &LastWriteTime2 );
|
|
||||||
|
|
||||||
FileClose( hFile );
|
|
||||||
|
|
||||||
fFile2Exist = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !fFile1Exist && !fFile2Exist )
|
|
||||||
return( -1 );
|
|
||||||
else if( fFile1Exist && !fFile2Exist )
|
|
||||||
{
|
|
||||||
if( fLatestAutoSave )
|
|
||||||
return( 0 );
|
|
||||||
else
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
else if( !fFile1Exist && fFile2Exist )
|
|
||||||
{
|
|
||||||
if( fLatestAutoSave )
|
|
||||||
return( 1 );
|
|
||||||
else
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( CompareSGPFileTimes( &LastWriteTime1, &LastWriteTime2 ) > 0 )
|
|
||||||
return( 0 );
|
|
||||||
else
|
|
||||||
return( 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleOldBobbyRMailOrders()
|
void HandleOldBobbyRMailOrders()
|
||||||
{
|
{
|
||||||
@@ -93,13 +93,10 @@ BOOLEAN CopySavedSoldierInfoToNewSoldier( SOLDIERTYPE *pDestSourceInfo, SOLDIERT
|
|||||||
BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile );
|
BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile );
|
||||||
BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile );
|
BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile );
|
||||||
|
|
||||||
BOOLEAN DoesUserHaveEnoughHardDriveSpace();
|
|
||||||
|
|
||||||
void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ );
|
void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ );
|
||||||
|
|
||||||
|
|
||||||
extern UINT32 guiLastSaveGameNum; // The end turn auto save number (0 = Auto00.sav, 1 = Auto01.sav)
|
extern UINT32 guiLastSaveGameNum; // The end turn auto save number (0 = Auto00.sav, 1 = Auto01.sav)
|
||||||
INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave );
|
|
||||||
|
|
||||||
/*CHRISL: This function is designed to allow reading the save game file one field at a time. We currently save structures by saving a block of memory,
|
/*CHRISL: This function is designed to allow reading the save game file one field at a time. We currently save structures by saving a block of memory,
|
||||||
but variables are stored in memory so that they fit neatly into a WORD resulting in the program automatically adding some padding. This padding is saved
|
but variables are stored in memory so that they fit neatly into a WORD resulting in the program automatically adding some padding. This padding is saved
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "screenids.h"
|
#include "screenids.h"
|
||||||
#include "container.h"
|
|
||||||
#include "overhead.h"
|
#include "overhead.h"
|
||||||
#include "sysutil.h"
|
#include "sysutil.h"
|
||||||
#include "Font Control.h"
|
#include "Font Control.h"
|
||||||
@@ -628,7 +628,14 @@ UINT32 MainGameScreenHandle(void)
|
|||||||
InternalLocateGridNo( gGameUBOptions.LOCATEGRIDNO, TRUE );
|
InternalLocateGridNo( gGameUBOptions.LOCATEGRIDNO, TRUE );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
if (gfFirstHeliRun)
|
||||||
|
{
|
||||||
InternalLocateGridNo( gGameExternalOptions.iInitialMercArrivalLocation, TRUE );
|
InternalLocateGridNo( gGameExternalOptions.iInitialMercArrivalLocation, TRUE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InternalLocateGridNo(gMapInformation.sCenterGridNo, TRUE);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
// Flugente: we might have reloaded the game, so we are currently not dropping mercs out of a helicopter
|
// Flugente: we might have reloaded the game, so we are currently not dropping mercs out of a helicopter
|
||||||
gfIngagedInDrop = FALSE;
|
gfIngagedInDrop = FALSE;
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "QuestText.h" //quest: name
|
#include "QuestText.h" //quest: name
|
||||||
#include "laptop.h" //ui positions
|
#include "laptop.h" //ui positions
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
#include "Utils/Cursors.h"
|
#include "Cursors.h"
|
||||||
#include "sysutil.h" //extra Buffer for scaling image
|
#include "sysutil.h" //extra Buffer for scaling image
|
||||||
#include "vsurface.h" //fill extra buffer with black color
|
#include "vsurface.h" //fill extra buffer with black color
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include "laptop.h"//UI dimensions, mouse regions
|
#include "laptop.h"//UI dimensions, mouse regions
|
||||||
#include "Utilities.h"//file names
|
#include "Utilities.h"//file names
|
||||||
#include "vobject.h"//video objects
|
#include "vobject.h"//video objects
|
||||||
#include "Utils/Cursors.h"
|
#include "Cursors.h"
|
||||||
#include "Text.h"//button text
|
#include "Text.h"//button text
|
||||||
#include "Button System.h"
|
#include "Button System.h"
|
||||||
#include "Encyclopedia_new.h"
|
#include "Encyclopedia_new.h"
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
add_library(Multiplayer
|
||||||
|
"client.cpp"
|
||||||
|
"server.cpp"
|
||||||
|
"transfer_rules.cpp"
|
||||||
|
)
|
||||||
|
target_include_directories(Multiplayer PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
"raknet"
|
||||||
|
)
|
||||||
|
target_link_libraries(Multiplayer PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/raknet/RakNetLibStatic.lib"
|
||||||
|
)
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,132 +0,0 @@
|
|||||||
//***********************************************
|
|
||||||
//
|
|
||||||
// Filename : Container.h
|
|
||||||
//
|
|
||||||
// Purpose : prototypes for the container file
|
|
||||||
//
|
|
||||||
// Modification History : 25 Nov 96 Creation
|
|
||||||
//
|
|
||||||
//***********************************************
|
|
||||||
|
|
||||||
#ifndef _CONTAINER_H
|
|
||||||
#define _CONTAINER_H
|
|
||||||
|
|
||||||
//***********************************************
|
|
||||||
//
|
|
||||||
// Includes
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//***********************************************
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
//***********************************************
|
|
||||||
//
|
|
||||||
// Defines and typedefs
|
|
||||||
//
|
|
||||||
//***********************************************
|
|
||||||
#define ORDLIST_ERROR -1
|
|
||||||
#define ORDLIST_EQUAL 0
|
|
||||||
#define ORDLIST_LEFT_LESS 1
|
|
||||||
#define ORDLIST_RIGHT_LESS 2
|
|
||||||
|
|
||||||
typedef void * HCONTAINER;
|
|
||||||
typedef HCONTAINER HSTACK;
|
|
||||||
typedef HCONTAINER HQUEUE;
|
|
||||||
typedef HCONTAINER HLIST;
|
|
||||||
typedef HCONTAINER HORDLIST;
|
|
||||||
|
|
||||||
//***********************************************
|
|
||||||
//
|
|
||||||
// Function Prototypes
|
|
||||||
//
|
|
||||||
//***********************************************
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// call these functions to initialize and shutdown the debug messages for
|
|
||||||
// containers
|
|
||||||
extern void InitializeContainers(void);
|
|
||||||
extern void ShutdownContainers(void);
|
|
||||||
|
|
||||||
// Stack Functions
|
|
||||||
// CreateStack(estimated number of items in stack, size of each item
|
|
||||||
// Push(handle to container returned from CreateStack, data to be passed in (must be void *)
|
|
||||||
// : returns handle to new stack
|
|
||||||
// Pop(handle to container returned from CreateStack, data to be passed in (must be void *)
|
|
||||||
// : returns BOOLEAN
|
|
||||||
// DeleteStack deletes the stack container
|
|
||||||
// StackSize returns size of stack
|
|
||||||
|
|
||||||
extern HSTACK CreateStack(UINT32 num_of_elem , UINT32 siz_of_each);
|
|
||||||
extern HSTACK Push(HSTACK hStack, void *data);
|
|
||||||
extern BOOLEAN Pop(HSTACK hStack, void *data);
|
|
||||||
extern UINT32 StackSize(HSTACK hStack);
|
|
||||||
extern BOOLEAN DeleteStack(HSTACK hStack);
|
|
||||||
extern BOOLEAN PeekStack(HSTACK hStack, void *data);
|
|
||||||
|
|
||||||
// Queue Functions
|
|
||||||
// CreateQueue(estimated number of items in queue, size of each item
|
|
||||||
// AddtoQueue(handle to container returned from CreateQueue, data to be passed in (must be void *))
|
|
||||||
// : returns handle to queue
|
|
||||||
// RemfromQueue(handle to container returned from CreateQueue, variable where data is stored (must be void *))
|
|
||||||
// : returns BOOLEAN
|
|
||||||
// PeekQueue(handle to the queue, variable where peeked data is stored). Item is not deleted.
|
|
||||||
// : returns BOOLEAN
|
|
||||||
// QueueSize(handle to the queue) returns the queue size
|
|
||||||
// DeleteQueue(handle to container) Delete the queue container
|
|
||||||
// : returns BOOLEAN
|
|
||||||
|
|
||||||
extern HQUEUE CreateQueue(UINT32 num_of_elem, UINT32 siz_of_each);
|
|
||||||
extern HQUEUE AddtoQueue(HQUEUE hQueue, void *data);
|
|
||||||
extern BOOLEAN RemfromQueue(HQUEUE hQueue,void *data);
|
|
||||||
extern BOOLEAN PeekQueue(HQUEUE hQueue, void *data);
|
|
||||||
extern UINT32 QueueSize(HQUEUE hQueue);
|
|
||||||
extern BOOLEAN DeleteQueue(HQUEUE hQueue);
|
|
||||||
|
|
||||||
// List Functions
|
|
||||||
// CreateList(estimated number of items in queue, size of each item
|
|
||||||
// AddtoList(handle to container returned from CreateQueue, data to be passed in (must be void *)
|
|
||||||
// position where data is to be added (0...sizeof(list))
|
|
||||||
// : returns handle to new list
|
|
||||||
// RemfromList(handle to container returned from CreateList, variable where data is stored (must be void *)
|
|
||||||
// position where data is to be deleted (0...sizeof(list)-1)
|
|
||||||
// PeekList(handle to the list, variable where peeked data is stored). Item is not deleted.
|
|
||||||
// position where data is to be peeked (0...sizeof(list)-1)
|
|
||||||
// ListSize(handle to the list) returns the list size
|
|
||||||
// DeleteList(handle to the list) Delete the list container
|
|
||||||
|
|
||||||
extern HLIST CreateList(UINT32 num_of_elem, UINT32 siz_of_each);
|
|
||||||
extern HLIST AddtoList(HLIST hList, void *data, UINT32 position);
|
|
||||||
extern BOOLEAN RemfromList(HLIST hList,void *data, UINT32 position);
|
|
||||||
extern BOOLEAN PeekList(HLIST hList, void *data, UINT32 position);
|
|
||||||
extern UINT32 ListSize(HLIST hList);
|
|
||||||
extern BOOLEAN DeleteList(HLIST hList);
|
|
||||||
extern BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos);
|
|
||||||
extern BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos);
|
|
||||||
|
|
||||||
// Ordered List Functions
|
|
||||||
// CreateOrdList(estimated number of items in ordered list, size of each item,
|
|
||||||
// pointer to a compare function that returns info on whether the data in the ordered stack
|
|
||||||
// is < or > the new data to be added into the ordered list.
|
|
||||||
// AddtoOrdList(handle to container returned from CreateOrdList, data to be passed in (must be void *)
|
|
||||||
// RemfromOrdList(handle to container returned from CreateList, variable where data is stored (must be void *)
|
|
||||||
// position where data is to be deleted (0...sizeof(list)-1)
|
|
||||||
// PeekOrdList(handle to the list, variable where peeked data is stored). Item is not deleted.
|
|
||||||
// position where data is to be peeked (0...sizeof(list)-1)
|
|
||||||
// OrdListSize(handle to the list) returns the ordered list size
|
|
||||||
// DeleteOrdList(handle to the list) Delete the ordered list container
|
|
||||||
|
|
||||||
extern HLIST CreateOrdList(UINT32 num_of_elem, UINT32 siz_of_each, INT8 (*compare)(void *,void *, UINT32));
|
|
||||||
extern HLIST AddtoOrdList(HLIST hList, void *data);
|
|
||||||
extern BOOLEAN RemfromOrdList(HLIST hList,void *data, UINT32 position);
|
|
||||||
extern BOOLEAN PeekOrdList(HLIST hList, void *data, UINT32 position);
|
|
||||||
extern UINT32 OrdListSize(HLIST hList);
|
|
||||||
extern BOOLEAN DeleteOrdList(HLIST hList);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
//
|
|
||||||
// Snap: Implementation of the TFileCat class
|
|
||||||
//
|
|
||||||
#include "FileCat.h"
|
|
||||||
#include "readdir.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Remove a slash or backslash (if any) from the end of a string
|
|
||||||
void ChompSlash(std::string& s)
|
|
||||||
{
|
|
||||||
if ( s.empty() ) return;
|
|
||||||
|
|
||||||
if ( *s.rbegin() == '\\' || *s.rbegin() == '/' ) {
|
|
||||||
s.erase( s.length() - 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Build a new file catalogue by recursively traversing the root directory
|
|
||||||
void TFileCat::NewCat(std::string root)
|
|
||||||
{
|
|
||||||
fRootDir = root;
|
|
||||||
ChompSlash(fRootDir);
|
|
||||||
|
|
||||||
fFileCat.clear();
|
|
||||||
|
|
||||||
TraverseDir(fRootDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Look for a given file in the catalogue
|
|
||||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
|
||||||
bool TFileCat::FindFile(std::string path, bool pathIncludesRoot) const
|
|
||||||
{
|
|
||||||
if (pathIncludesRoot) return fFileCat.find(path) != fFileCat.end();
|
|
||||||
else return fFileCat.find(fRootDir + '\\' + path) != fFileCat.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Delete a given file from the catalogue
|
|
||||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
|
||||||
size_t TFileCat::RemoveFile(std::string path, bool pathIncludesRoot)
|
|
||||||
{
|
|
||||||
if (pathIncludesRoot) return fFileCat.erase(path);
|
|
||||||
else return fFileCat.erase(fRootDir + '\\' + path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Delete all files from a given directory in the catalogue
|
|
||||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
|
||||||
size_t TFileCat::RemoveDir(std::string dir, bool pathIncludesRoot)
|
|
||||||
{
|
|
||||||
if ( !pathIncludesRoot ) dir = fRootDir + '\\' + dir;
|
|
||||||
ChompSlash(dir);
|
|
||||||
std::string dirlower = dir + '\\';
|
|
||||||
std::string dirupper = dir + char('\\'+1);
|
|
||||||
|
|
||||||
TCatalogue::iterator upper = fFileCat.upper_bound(dirupper);
|
|
||||||
TCatalogue::iterator lower;
|
|
||||||
|
|
||||||
int deleted = 0;
|
|
||||||
|
|
||||||
while ( ( lower = fFileCat.lower_bound(dirlower) ) != upper) {
|
|
||||||
fFileCat.erase(lower);
|
|
||||||
deleted++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return deleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Recursively traverse a directory, adding regular files to the catalogue
|
|
||||||
void TFileCat::TraverseDir(std::string dir, int depth)
|
|
||||||
{
|
|
||||||
using std::string;
|
|
||||||
static string dot( ".");
|
|
||||||
static string dotdot( "..");
|
|
||||||
static string svn( ".svn");
|
|
||||||
|
|
||||||
if (!dir.empty()) dir += '\\';
|
|
||||||
|
|
||||||
TReadDir readDir((dir + "*").c_str());
|
|
||||||
|
|
||||||
char const* fileName;
|
|
||||||
unsigned attrib;
|
|
||||||
|
|
||||||
while ( readDir.NextFile(fileName, attrib) ) {
|
|
||||||
if (dot == fileName || dotdot == fileName || svn == fileName) continue;
|
|
||||||
|
|
||||||
string fullPath = dir + fileName;
|
|
||||||
|
|
||||||
if (attrib & FILE_ATTRIBUTE_DIRECTORY) {
|
|
||||||
if (depth < 0) TraverseDir(fullPath);
|
|
||||||
else if (depth > 0) TraverseDir(fullPath, depth-1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fFileCat.insert(fullPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
//
|
|
||||||
// Snap: Declaration of the TFileCat class
|
|
||||||
//
|
|
||||||
// This class catalogues files in a directory and all its subdirectories
|
|
||||||
//
|
|
||||||
#ifndef FILECAT_H
|
|
||||||
#define FILECAT_H
|
|
||||||
|
|
||||||
#include "stringicmp.h"
|
|
||||||
#include <string>
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
|
|
||||||
class TFileCat {
|
|
||||||
public:
|
|
||||||
|
|
||||||
TFileCat(std::string root) { NewCat(root); }
|
|
||||||
TFileCat() {}
|
|
||||||
|
|
||||||
// Build a new file catalogue by recursively traversing the root directory
|
|
||||||
void NewCat(std::string root);
|
|
||||||
|
|
||||||
std::string GetRootDir() const { return fRootDir; }
|
|
||||||
|
|
||||||
// Look for a given file in the catalogue
|
|
||||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
|
||||||
bool FindFile(std::string path, bool pathIncludesRoot = false) const;
|
|
||||||
|
|
||||||
// Delete a given file from the catalogue
|
|
||||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
|
||||||
size_t RemoveFile(std::string path, bool pathIncludesRoot = false);
|
|
||||||
|
|
||||||
// Delete all files from a given directory in the catalogue
|
|
||||||
// Unless pathIncludesRoot == true, will prepend the root directory to path
|
|
||||||
size_t RemoveDir(std::string dir, bool pathIncludesRoot = false);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
typedef std::set<std::string, TStringiLess> TCatalogue;
|
|
||||||
|
|
||||||
std::string fRootDir;
|
|
||||||
TCatalogue fFileCat;
|
|
||||||
|
|
||||||
// Recursively traverse a directory, adding regular files to the catalogue
|
|
||||||
void TraverseDir(std::string dir, int depth = -1);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // FILECAT_H
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,56 +0,0 @@
|
|||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Filename : Install.c
|
|
||||||
//
|
|
||||||
// Purpose : install routines
|
|
||||||
//
|
|
||||||
// Modification history :
|
|
||||||
//
|
|
||||||
// 02dec96:HJH - Creation
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Includes
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include <windows.h>
|
|
||||||
#include "Install.h"
|
|
||||||
#include "RegInst.h"
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Defines
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Typedefs
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Functions
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
BOOLEAN InstallApplication( STR strAppname, STR strPath )
|
|
||||||
{
|
|
||||||
HKEY hKey;
|
|
||||||
BOOL fRet = TRUE;
|
|
||||||
|
|
||||||
hKey = GetAppRegistryKey();
|
|
||||||
RegCloseKey( hKey );
|
|
||||||
|
|
||||||
//hKeySection = GetSectionKey("Startup");
|
|
||||||
//RegCloseKey( hKeySection );
|
|
||||||
|
|
||||||
fRet = fRet && WriteProfileChar( "Startup", "InstPath", strPath );
|
|
||||||
|
|
||||||
return(fRet);
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Filename : Install.h
|
|
||||||
//
|
|
||||||
// Purpose : prototypes for the install routines
|
|
||||||
//
|
|
||||||
// Modification history :
|
|
||||||
//
|
|
||||||
// 02dec96:HJH - Creation
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#ifndef _Install_h
|
|
||||||
#define _Install_h
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Includes
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Defines
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Typedefs
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Function Prototypes
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern BOOLEAN InstallApplication( STR strAppname, STR strPath );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,380 +0,0 @@
|
|||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Filename : RegInst.c
|
|
||||||
//
|
|
||||||
// Purpose : registry routines
|
|
||||||
//
|
|
||||||
// Modification history :
|
|
||||||
//
|
|
||||||
// 02dec96:HJH - Creation
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Includes
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "RegInst.h"
|
|
||||||
#include "WCheck.h"
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Defines
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#define REG_KEY_SIZE 50
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Variables
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
// INI strings are not localized
|
|
||||||
static const TCHAR szSoftware[] = _T("Software");
|
|
||||||
|
|
||||||
static CHAR gszRegistryKey[REG_KEY_SIZE];
|
|
||||||
static CHAR gszAppName[REG_KEY_SIZE];
|
|
||||||
static CHAR gszProfileName[REG_KEY_SIZE];
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Functions
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
BOOLEAN InitializeRegistryKeys(STR lpszAppName, STR lpszRegistryKey)
|
|
||||||
{
|
|
||||||
CHECKF(lpszAppName != NULL);
|
|
||||||
CHECKF(lpszRegistryKey != NULL);
|
|
||||||
//CHECKF(gpszRegistryKey == NULL);
|
|
||||||
//CHECKF(gpszAppName == NULL);
|
|
||||||
//CHECKF(gpszProfileName == NULL);
|
|
||||||
|
|
||||||
// Note: this will leak the original gpszProfileName, but it
|
|
||||||
// will be freed when the application exits. No assumptions
|
|
||||||
// can be made on how gpszProfileName was allocated.
|
|
||||||
|
|
||||||
strcpy( gszAppName, lpszAppName);
|
|
||||||
strcpy( gszRegistryKey, lpszRegistryKey );
|
|
||||||
strcpy( gszProfileName, gszAppName);
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns key for HKEY_CURRENT_USER\"Software"\RegistryKey\ProfileName
|
|
||||||
// creating it if it doesn't exist
|
|
||||||
// responsibility of the caller to call RegCloseKey() on the returned HKEY
|
|
||||||
HKEY GetAppRegistryKey()
|
|
||||||
{
|
|
||||||
HKEY hAppKey = NULL;
|
|
||||||
HKEY hSoftKey = NULL;
|
|
||||||
HKEY hCompanyKey = NULL;
|
|
||||||
|
|
||||||
assert(gszRegistryKey[0] != '\0');
|
|
||||||
//assert(gpszProfileName != NULL);
|
|
||||||
|
|
||||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, szSoftware, 0, KEY_WRITE|KEY_READ,
|
|
||||||
&hSoftKey) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
DWORD dw;
|
|
||||||
if (RegCreateKeyEx(hSoftKey, gszRegistryKey, 0, REG_NONE,
|
|
||||||
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
|
|
||||||
&hCompanyKey, &dw) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
RegCreateKeyEx(hCompanyKey, gszProfileName, 0, REG_NONE,
|
|
||||||
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
|
|
||||||
&hAppKey, &dw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hSoftKey != NULL)
|
|
||||||
RegCloseKey(hSoftKey);
|
|
||||||
if (hCompanyKey != NULL)
|
|
||||||
RegCloseKey(hCompanyKey);
|
|
||||||
|
|
||||||
return hAppKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns key for:
|
|
||||||
// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection
|
|
||||||
// creating it if it doesn't exist.
|
|
||||||
// responsibility of the caller to call RegCloseKey() on the returned HKEY
|
|
||||||
HKEY GetSectionKey(STR lpszSection)
|
|
||||||
{
|
|
||||||
HKEY hSectionKey = NULL;
|
|
||||||
HKEY hAppKey = GetAppRegistryKey();
|
|
||||||
DWORD dw;
|
|
||||||
|
|
||||||
assert(lpszSection != NULL);
|
|
||||||
|
|
||||||
if (hAppKey == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
RegCreateKeyEx(hAppKey, lpszSection, 0, REG_NONE,
|
|
||||||
REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL,
|
|
||||||
&hSectionKey, &dw);
|
|
||||||
RegCloseKey(hAppKey);
|
|
||||||
return hSectionKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT GetProfileInteger(STR lpszSection, STR lpszEntry, int nDefault)
|
|
||||||
{
|
|
||||||
DWORD dwValue;
|
|
||||||
DWORD dwType;
|
|
||||||
DWORD dwCount = sizeof(DWORD);
|
|
||||||
LONG lResult;
|
|
||||||
|
|
||||||
assert(lpszSection != NULL);
|
|
||||||
assert(lpszEntry != NULL);
|
|
||||||
|
|
||||||
if (gszRegistryKey[0] != '\0') // use registry
|
|
||||||
{
|
|
||||||
HKEY hSecKey = GetSectionKey(lpszSection);
|
|
||||||
if (hSecKey == NULL)
|
|
||||||
return nDefault;
|
|
||||||
lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
|
|
||||||
(LPBYTE)&dwValue, &dwCount);
|
|
||||||
RegCloseKey(hSecKey);
|
|
||||||
if (lResult == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
assert(dwType == REG_DWORD);
|
|
||||||
assert(dwCount == sizeof(dwValue));
|
|
||||||
return (UINT)dwValue;
|
|
||||||
}
|
|
||||||
return nDefault;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
assert(gszProfileName[0] != '\0');
|
|
||||||
return GetPrivateProfileInt(lpszSection, lpszEntry, nDefault,
|
|
||||||
gszProfileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN GetProfileChar(STR lpszSection, STR lpszEntry, STR lpszDefault, STR lpszValue)
|
|
||||||
{
|
|
||||||
DWORD dwType, dwCount;
|
|
||||||
LONG lResult;
|
|
||||||
BOOLEAN fRet = TRUE;
|
|
||||||
CHAR strValue[200];
|
|
||||||
|
|
||||||
assert(lpszSection != NULL);
|
|
||||||
assert(lpszEntry != NULL);
|
|
||||||
assert(lpszDefault != NULL);
|
|
||||||
|
|
||||||
if (gszRegistryKey[0] != '\0')
|
|
||||||
{
|
|
||||||
HKEY hSecKey = GetSectionKey(lpszSection);
|
|
||||||
if (hSecKey == NULL)
|
|
||||||
{
|
|
||||||
strcpy( lpszValue, lpszDefault );
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
|
|
||||||
NULL, &dwCount);
|
|
||||||
if (lResult == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
assert(dwType == REG_SZ);
|
|
||||||
lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
|
|
||||||
(LPBYTE)strValue, &dwCount);
|
|
||||||
}
|
|
||||||
RegCloseKey(hSecKey);
|
|
||||||
if (lResult == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
assert(dwType == REG_SZ);
|
|
||||||
strcpy( lpszValue, strValue );
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
strcpy( lpszValue, lpszDefault );
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// assert(gpszProfileName != NULL);
|
|
||||||
//
|
|
||||||
// if (lpszDefault == NULL)
|
|
||||||
// lpszDefault = &afxChNil; // don't pass in NULL
|
|
||||||
// TCHAR szT[4096];
|
|
||||||
// DWORD dw = ::GetPrivateProfileString(lpszSection, lpszEntry,
|
|
||||||
// lpszDefault, szT, _countof(szT), gpszProfileName);
|
|
||||||
// assert(dw < 4095);
|
|
||||||
// return szT;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return( fRet );
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL GetProfileBinary(STR lpszSection, STR lpszEntry,
|
|
||||||
BYTE** ppData, UINT* pBytes)
|
|
||||||
{
|
|
||||||
// DWORD dwType, dwCount;
|
|
||||||
// LONG lResult;
|
|
||||||
//
|
|
||||||
// assert(lpszSection != NULL);
|
|
||||||
// assert(lpszEntry != NULL);
|
|
||||||
// assert(ppData != NULL);
|
|
||||||
// assert(pBytes != NULL);
|
|
||||||
// *ppData = NULL;
|
|
||||||
// *pBytes = 0;
|
|
||||||
//
|
|
||||||
// if (gpszRegistryKey != NULL)
|
|
||||||
// {
|
|
||||||
// LPBYTE lpByte = NULL;
|
|
||||||
// HKEY hSecKey = GetSectionKey(lpszSection);
|
|
||||||
// if (hSecKey == NULL)
|
|
||||||
// return FALSE;
|
|
||||||
//
|
|
||||||
// lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
|
|
||||||
// NULL, &dwCount);
|
|
||||||
// *pBytes = dwCount;
|
|
||||||
// if (lResult == ERROR_SUCCESS)
|
|
||||||
// {
|
|
||||||
// assert(dwType == REG_BINARY);
|
|
||||||
// *ppData = new BYTE[*pBytes];
|
|
||||||
// lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
|
|
||||||
// *ppData, &dwCount);
|
|
||||||
// }
|
|
||||||
// RegCloseKey(hSecKey);
|
|
||||||
// if (lResult == ERROR_SUCCESS)
|
|
||||||
// {
|
|
||||||
// assert(dwType == REG_BINARY);
|
|
||||||
// return TRUE;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// delete [] *ppData;
|
|
||||||
// *ppData = NULL;
|
|
||||||
// }
|
|
||||||
// return FALSE;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// //assert(gpszProfileName != NULL);
|
|
||||||
// //
|
|
||||||
// //CString str = GetProfileString(lpszSection, lpszEntry, NULL);
|
|
||||||
// //if (str.IsEmpty())
|
|
||||||
// // return FALSE;
|
|
||||||
// //assert(str.GetLength()%2 == 0);
|
|
||||||
// //int nLen = str.GetLength();
|
|
||||||
// //*pBytes = nLen/2;
|
|
||||||
// //*ppData = new BYTE[*pBytes];
|
|
||||||
// //for (int i=0;i<nLen;i+=2)
|
|
||||||
// //{
|
|
||||||
// // (*ppData)[i/2] = (BYTE)
|
|
||||||
// // (((str[i+1] - _T('A')) << 4) + (str[i] - _T('A')));
|
|
||||||
// //}
|
|
||||||
// return TRUE;
|
|
||||||
// }
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WriteProfileInt(STR lpszSection, STR lpszEntry, int nValue)
|
|
||||||
{
|
|
||||||
// LONG lResult;
|
|
||||||
// TCHAR szT[16];
|
|
||||||
//
|
|
||||||
// assert(lpszSection != NULL);
|
|
||||||
// assert(lpszEntry != NULL);
|
|
||||||
//
|
|
||||||
// if (gpszRegistryKey != NULL)
|
|
||||||
// {
|
|
||||||
// HKEY hSecKey = GetSectionKey(lpszSection);
|
|
||||||
// if (hSecKey == NULL)
|
|
||||||
// return FALSE;
|
|
||||||
// lResult = RegSetValueEx(hSecKey, lpszEntry, NULL, REG_DWORD,
|
|
||||||
// (LPBYTE)&nValue, sizeof(nValue));
|
|
||||||
// RegCloseKey(hSecKey);
|
|
||||||
// return lResult == ERROR_SUCCESS;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// assert(gpszProfileName != NULL);
|
|
||||||
//
|
|
||||||
// wsprintf(szT, _T("%d"), nValue);
|
|
||||||
// return ::WritePrivateProfileString(lpszSection, lpszEntry, szT,
|
|
||||||
// gpszProfileName);
|
|
||||||
// }
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WriteProfileChar(STR lpszSection, STR lpszEntry, STR lpszValue)
|
|
||||||
{
|
|
||||||
assert(lpszSection != NULL);
|
|
||||||
|
|
||||||
if (gszRegistryKey[0] != '\0')
|
|
||||||
{
|
|
||||||
LONG lResult;
|
|
||||||
if (lpszEntry == NULL) //delete whole section
|
|
||||||
{
|
|
||||||
HKEY hAppKey = GetAppRegistryKey();
|
|
||||||
if (hAppKey == NULL)
|
|
||||||
return FALSE;
|
|
||||||
lResult = RegDeleteKey(hAppKey, lpszSection);
|
|
||||||
RegCloseKey(hAppKey);
|
|
||||||
}
|
|
||||||
else if (lpszValue == NULL)
|
|
||||||
{
|
|
||||||
HKEY hSecKey = GetSectionKey(lpszSection);
|
|
||||||
if (hSecKey == NULL)
|
|
||||||
return FALSE;
|
|
||||||
// necessary to cast away const below
|
|
||||||
lResult = RegDeleteValue(hSecKey, (LPTSTR)lpszEntry);
|
|
||||||
RegCloseKey(hSecKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HKEY hSecKey = GetSectionKey(lpszSection);
|
|
||||||
if (hSecKey == NULL)
|
|
||||||
return FALSE;
|
|
||||||
lResult = RegSetValueEx(hSecKey, lpszEntry, 0, REG_SZ,
|
|
||||||
(LPBYTE)lpszValue, (lstrlen(lpszValue)+1)*sizeof(TCHAR));
|
|
||||||
RegCloseKey(hSecKey);
|
|
||||||
}
|
|
||||||
return lResult == ERROR_SUCCESS;
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// assert(gpszProfileName != NULL);
|
|
||||||
// assert(lstrlen(gpszProfileName) < 4095); // can't read in bigger
|
|
||||||
// return ::WritePrivateProfileString(lpszSection, lpszEntry, lpszValue,
|
|
||||||
// gpszProfileName);
|
|
||||||
// }
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WriteProfileBinary(STR lpszSection, STR lpszEntry, LPBYTE pData, UINT nBytes)
|
|
||||||
{
|
|
||||||
// assert(lpszSection != NULL);
|
|
||||||
//
|
|
||||||
// if (gpszRegistryKey != NULL)
|
|
||||||
// {
|
|
||||||
// LONG lResult;
|
|
||||||
// HKEY hSecKey = GetSectionKey(lpszSection);
|
|
||||||
// if (hSecKey == NULL)
|
|
||||||
// return FALSE;
|
|
||||||
// lResult = RegSetValueEx(hSecKey, lpszEntry, NULL, REG_BINARY,
|
|
||||||
// pData, nBytes);
|
|
||||||
// RegCloseKey(hSecKey);
|
|
||||||
// return lResult == ERROR_SUCCESS;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // convert to string and write out
|
|
||||||
// LPTSTR lpsz = new TCHAR[nBytes*2+1];
|
|
||||||
// for (UINT i = 0; i < nBytes; i++)
|
|
||||||
// {
|
|
||||||
// lpsz[i*2] = (TCHAR)((pData[i] & 0x0F) + _T('A')); //low nibble
|
|
||||||
// lpsz[i*2+1] = (TCHAR)(((pData[i] >> 4) & 0x0F) + _T('A')); //high nibble
|
|
||||||
// }
|
|
||||||
// lpsz[i*2] = 0;
|
|
||||||
//
|
|
||||||
// assert(gpszProfileName != NULL);
|
|
||||||
//
|
|
||||||
// BOOL bResult = WriteProfileString(lpszSection, lpszEntry, lpsz);
|
|
||||||
// delete[] lpsz;
|
|
||||||
// return bResult;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Filename : RegInst.h
|
|
||||||
//
|
|
||||||
// Purpose : prototypes for the registry stuff
|
|
||||||
//
|
|
||||||
// Modification history :
|
|
||||||
//
|
|
||||||
// 02dec96:HJH - Creation
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#ifndef _RegInst_h
|
|
||||||
#define _RegInst_h
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Includes
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Defines
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Typedefs
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Function Prototypes
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// call once per execution of application:
|
|
||||||
extern BOOLEAN InitializeRegistryKeys(STR strAppName, STR strRegistryKey);
|
|
||||||
|
|
||||||
// returns key for HKEY_CURRENT_USER\"Software"\RegistryKey\ProfileName
|
|
||||||
// creating it if it doesn't exist
|
|
||||||
// responsibility of the caller to call RegCloseKey() on the returned HKEY
|
|
||||||
extern HKEY GetAppRegistryKey();
|
|
||||||
|
|
||||||
// returns key for:
|
|
||||||
// HKEY_CURRENT_USER\"Software"\RegistryKey\AppName\lpszSection
|
|
||||||
// creating it if it doesn't exist.
|
|
||||||
// responsibility of the caller to call RegCloseKey() on the returned HKEY
|
|
||||||
extern HKEY GetSectionKey(STR lpszSection);
|
|
||||||
|
|
||||||
extern UINT GetProfileInteger(STR lpszSection, STR lpszEntry, int nDefault);
|
|
||||||
extern BOOLEAN GetProfileChar(STR lpszSection, STR lpszEntry, STR lpszDefault, STR lpszValue);
|
|
||||||
extern BOOL GetProfileBinary(STR lpszSection, STR lpszEntry, BYTE** ppData, UINT* pBytes);
|
|
||||||
extern BOOL WriteProfileInt(STR lpszSection, STR lpszEntry, int nValue);
|
|
||||||
extern BOOL WriteProfileChar(STR lpszSection, STR lpszEntry, STR lpszValue);
|
|
||||||
extern BOOL WriteProfileBinary(STR lpszSection, STR lpszEntry, LPBYTE pData, UINT nBytes);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,224 +0,0 @@
|
|||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Filename : flic.h
|
|
||||||
//
|
|
||||||
// Purpose : to define some flic stuff
|
|
||||||
//
|
|
||||||
// Modification history :
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#ifndef __FLIC_H
|
|
||||||
#define __FLIC_H
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Includes
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#include "sgp.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Defines
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#define ErrFlicLibAccess -1
|
|
||||||
#define ErrFlicAccess -2
|
|
||||||
#define ErrFlicSeek -3
|
|
||||||
#define ErrFlicRead -4
|
|
||||||
#define ErrFlicBad -5
|
|
||||||
#define ErrFlicBadFrame -6
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Typedefs
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
struct _Flic;
|
|
||||||
|
|
||||||
typedef signed char Char; /* Signed 8 bits. */
|
|
||||||
typedef unsigned char Uchar; /* Unsigned 8 bits. */
|
|
||||||
typedef short Short; /* Signed 16 bits please. */
|
|
||||||
typedef unsigned short Ushort; /* Unsigned 16 bits please. */
|
|
||||||
typedef long Long; /* Signed 32 bits. */
|
|
||||||
typedef unsigned long Ulong; /* Unsigned 32 bits. */
|
|
||||||
|
|
||||||
typedef int Boolean; /* TRUE or FALSE value. */
|
|
||||||
typedef int ErrCode; /* ErrXXX or Success. */
|
|
||||||
typedef int FileHandle; /* OS file handle. */
|
|
||||||
|
|
||||||
typedef Uchar Pixel; /* Pixel type. */
|
|
||||||
|
|
||||||
typedef ErrCode FlicOpenFunc(struct _Flic *flic, const char *filename);
|
|
||||||
typedef ErrCode FlicCheckFrameFunc(struct _Flic *);
|
|
||||||
typedef ErrCode FlicSeekFunc(struct _Flic *, long offset);
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Uchar r,g,b;
|
|
||||||
} Colour; /* One color map entry r,g,b 0-255. */
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Pixel pixels[2];
|
|
||||||
} Pixels2; /* For word-oriented run length encoding */
|
|
||||||
|
|
||||||
/* Flic Header */
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Long size; /* Size of flic including this header. */
|
|
||||||
Ushort type; /* Either FLI_TYPE or FLC_TYPE below. */
|
|
||||||
Ushort frames; /* Number of frames in flic. */
|
|
||||||
Ushort width; /* Flic width in pixels. */
|
|
||||||
Ushort height; /* Flic height in pixels. */
|
|
||||||
Ushort depth; /* Bits per pixel. (Always 8 now.) */
|
|
||||||
Ushort flags; /* FLI_FINISHED | FLI_LOOPED ideally. */
|
|
||||||
Long speed; /* Delay between frames. */
|
|
||||||
Short reserved1; /* Set to zero. */
|
|
||||||
Short created1;
|
|
||||||
Short created2;
|
|
||||||
//Ulong created; /* Date of flic creation. (FLC only.) */
|
|
||||||
Short creator1;
|
|
||||||
Short creator2;
|
|
||||||
//Ulong creator; /* Serial # of flic creator. (FLC only.) */
|
|
||||||
Short updated1;
|
|
||||||
Short updated2;
|
|
||||||
//Ulong updated; /* Date of flic update. (FLC only.) */
|
|
||||||
Short updater1;
|
|
||||||
Short updater2;
|
|
||||||
//Ulong updater; /* Serial # of flic updater. (FLC only.) */
|
|
||||||
Ushort aspect_dx; /* Width of square rectangle. (FLC only.) */
|
|
||||||
Ushort aspect_dy; /* Height of square rectangle. (FLC only.) */
|
|
||||||
Char reserved2[38]; /* Set to zero. */
|
|
||||||
Long oframe1; /* Offset to frame 1. (FLC only.) */
|
|
||||||
Long oframe2; /* Offset to frame 2. (FLC only.) */
|
|
||||||
Char reserved3[40]; /* Set to zero. */
|
|
||||||
} FlicHead;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Pixel *pixels; /* Set to AOOO:0000 for hardware. */
|
|
||||||
int width, height; /* Dimensions of screen. (320x200) */
|
|
||||||
char change_palette; /*True means that the flic changes the palette */
|
|
||||||
} FlicScreen; /* Device specific screen type. */
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Ulong max_loop_count,
|
|
||||||
loop_count;
|
|
||||||
Ushort max_frame_index,
|
|
||||||
frame_index;
|
|
||||||
} FlicFrameStatus;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
// lmlib_t *names;
|
|
||||||
long offset,
|
|
||||||
length;
|
|
||||||
}FlicLib;
|
|
||||||
|
|
||||||
typedef struct _Flic
|
|
||||||
{
|
|
||||||
FlicHead head; /* Flic file header. */
|
|
||||||
FILE *file; /* File handle. */
|
|
||||||
const char *name; /* Name from flic_open. Helps error reporting. */
|
|
||||||
int xoff,yoff; /* Offset to display flic at. */
|
|
||||||
|
|
||||||
FlicFrameStatus status;
|
|
||||||
FlicScreen screen;
|
|
||||||
FlicLib lib;
|
|
||||||
|
|
||||||
FlicOpenFunc *open;
|
|
||||||
FlicCheckFrameFunc *check_frame;
|
|
||||||
FlicSeekFunc *seek;
|
|
||||||
|
|
||||||
} Flic;
|
|
||||||
|
|
||||||
/* Values for FlicHead.type */
|
|
||||||
#define FLI_TYPE 0xAF11u /* 320x200 .FLI type ID */
|
|
||||||
#define FLC_TYPE 0xAF12u /* Variable rez .FLC type ID */
|
|
||||||
/* Values for FlicHead.flags */
|
|
||||||
#define FLI_FINISHED 0x0001
|
|
||||||
#define FLI_LOOPED 0x0002
|
|
||||||
|
|
||||||
/* Optional Prefix Header */
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Long size; /* Size of prefix including header. */
|
|
||||||
Ushort type; /* Always PREFIX_TYPE. */
|
|
||||||
Short chunks; /* Number of subchunks in prefix. */
|
|
||||||
Char reserved[8];/* Always 0. */
|
|
||||||
} PrefixHead;
|
|
||||||
|
|
||||||
/* Value for PrefixHead.type */
|
|
||||||
#define PREFIX_TYPE 0xF100u
|
|
||||||
|
|
||||||
/* Frame Header */
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Long size; /* Size of frame including header. */
|
|
||||||
Ushort type; /* Always FRAME_TYPE */
|
|
||||||
Short chunks; /* Number of chunks in frame. */
|
|
||||||
Char reserved[8];/* Always 0. */
|
|
||||||
} FrameHead;
|
|
||||||
|
|
||||||
/* Value for FrameHead.type */
|
|
||||||
#define FRAME_TYPE 0xF1FAu
|
|
||||||
|
|
||||||
/* Chunk Header */
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Long size; /* Size of chunk including header. */
|
|
||||||
Ushort type; /* Value from ChunkTypes below. */
|
|
||||||
} ChunkHead;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
COLOR_256 = 4, /* 256 level color pallette info. (FLC only.) */
|
|
||||||
DELTA_FLC = 7, /* Word-oriented delta compression. (FLC only.) */
|
|
||||||
COLOR_64 = 11, /* 64 level color pallette info. */
|
|
||||||
DELTA_FLI = 12, /* Byte-oriented delta compression. */
|
|
||||||
BLACK_FRAME = 13, /* whole frame is color 0 */
|
|
||||||
BYTE_RUN = 15, /* Byte run-length compression. */
|
|
||||||
LITERAL = 16, /* Uncompressed pixels. */
|
|
||||||
PSTAMP = 18, /* "Postage stamp" chunk. (FLC only.) */
|
|
||||||
} ChunkTypes;
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
//
|
|
||||||
// Function prototypes.
|
|
||||||
//
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
void FlicInit(Flic *flic, unsigned screen_width, unsigned screen_height, char change_palette, char *Buffer);
|
|
||||||
ErrCode FlicOpen(Flic *flic, const char *filename);
|
|
||||||
void FlicSetOrigin(Flic *flic, unsigned x, unsigned y);
|
|
||||||
ErrCode FlicPlay(Flic *flic, Ulong max_loop);
|
|
||||||
void FlicClose(Flic *flic);
|
|
||||||
void FlicSeekFirst(Flic *flic);
|
|
||||||
int FlicAdvance(Flic *flic, BOOL fDecode);
|
|
||||||
int FlicAdvanceNoDecode(Flic *flic);
|
|
||||||
int FlicStart(char *filename, int width, int height, char *buffer, Flic *flic, char usepal);
|
|
||||||
void FlicStop(Flic *flic);
|
|
||||||
ErrCode FlicGetStats(char *filename, int width, int height, Flic *flic, int *piBufferSize, int *piColourPalSize);
|
|
||||||
ErrCode FlicGetColourPalette(CHAR *filename, int width, int height, CHAR **ppBuffer, INT *piNumColours);
|
|
||||||
CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize);
|
|
||||||
INT FlicFindByteRunBeforeFrame(Flic *flic, INT iFrame);
|
|
||||||
ErrCode FlicFillBitmapData( Flic *flic, INT iPrevFrame, INT iFrame, HBITMAP hBitmap );
|
|
||||||
ErrCode FlicFillFrameData( Flic *flic, INT iPrevFrame, INT iFrame, CHAR *, INT * );
|
|
||||||
void FlicClearBitmap( HBITMAP hBitmap, INT iColourIndex );
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
extern char FlicPal[768];
|
|
||||||
#endif
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
//
|
|
||||||
// Snap: Implementation of the TReadDir class
|
|
||||||
// This class reads the contents of a directory file-by-file
|
|
||||||
//
|
|
||||||
#include "readdir.h"
|
|
||||||
|
|
||||||
TReadDir::TReadDir(char const* searchPattern)
|
|
||||||
{
|
|
||||||
fSearchHandle = FindFirstFile(searchPattern, &fFileInfo);
|
|
||||||
fFirstRequest = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TReadDir::NextFile(char const* &fileName, unsigned &attrib)
|
|
||||||
{
|
|
||||||
if (fSearchHandle == INVALID_HANDLE_VALUE) return false;
|
|
||||||
if (fFirstRequest) fFirstRequest = false;
|
|
||||||
else if ( !FindNextFile(fSearchHandle, &fFileInfo) ) return false;
|
|
||||||
fileName = fFileInfo.cFileName;
|
|
||||||
attrib = fFileInfo.dwFileAttributes;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user