Skip to content

Commit

Permalink
Visual Studio Fixes (#106)
Browse files Browse the repository at this point in the history
* Visual Studio Fixes

* Disable flooring the frame period to 10ms

* Don't build with mingw on gha
  • Loading branch information
madebr committed Mar 16, 2022
1 parent e61ecfa commit d3ebbb6
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 104 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,52 +82,6 @@ jobs:
name: artifacts
path: windows-${{ matrix.platform }}.zip

build-mingw:
runs-on: 'ubuntu-latest'
strategy:
matrix:
platform: [x86, amd64]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Build
run: |
.github/scripts/build-mingw.sh
env:
MATRIX_PLATFORM: ${{ matrix.platform }}

build-mingw-msys2:
runs-on: 'windows-latest'
strategy:
matrix:
include:
- platform: x86
msystem: mingw32
- platform: amd64
msystem: mingw64
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
- name: Build
run: |
.github/scripts/build-mingw.sh
env:
MATRIX_PLATFORM: ${{ matrix.platform }}
- name: Test
run: |
cd build
ctest --verbose

create-release:
needs: [build-linux, build-macos, build-windows]
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo" FORCE)
endif()

set(DETHRACE_IDE_ARGUMENTS "" CACHE STRING "DethRace arguments (only used by MSVC when debugging")
set(DETHRACE_IDE_ROOT_DIR "" CACHE PATH "DethRace rootdir (only used by MSVC when debugging)")

set(CMAKE_POSITION_INDEPENDENT_CODE OFF)

project(dethrace C)
Expand Down
3 changes: 2 additions & 1 deletion src/BRSRC13/CORE/FW/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource_header* UserToRes(void* r) {
p--;
}
if (((resource_header*)(p - (sizeof(resource_header) - 1)))->magic_num != 0xdeadbeef) {
LOG_PANIC("Bad resource header from user at %p. Was %X", r, ((resource_header*)p)->magic_num);
LOG_PANIC("Bad resource header from user at %p. Was 0x%x", r, ((resource_header*)p)->magic_num);
}
return (resource_header*)(p - (sizeof(resource_header) - 1));
}
Expand Down Expand Up @@ -212,6 +212,7 @@ br_uint_32 BrResChildEnum(void* vres, br_resenum_cbfn* callback, void* arg) {
LOG_TRACE("(%p, %p, %p)", vres, callback, arg);

res = UserToRes(vres);
r = 0;
for (rp = (resource_header*)res->children.head; rp != NULL; rp = (resource_header*)rp->node.next) {
r = callback(ResToUser(rp), arg);
if (r != 0) {
Expand Down
14 changes: 14 additions & 0 deletions src/DETHRACE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,17 @@ else()
target_link_options(dethrace PRIVATE /subsystem:windows /ENTRY:mainCRTStartup)
target_compile_definitions(dethrace PRIVATE -D_CRT_SECURE_NO_WARNINGS -DSDL_MAIN_HANDLED)
endif()

if(DETHRACE_IDE_ROOT_DIR)
set_target_properties(dethrace PROPERTIES
VS_DEBUGGER_ENVIRONMENT "DETHRACE_ROOT_DIR=${DETHRACE_IDE_ROOT_DIR}"
)
endif()
if(DETHRACE_IDE_ARGUMENTS)
message(STATUS "before: ${DETHRACE_IDE_ARGUMENTS}")
separate_arguments(DETHRACE_IDE_ARGUMENTS NATIVE_COMMAND "${DETHRACE_IDE_ARGUMENTS}")
message(STATUS "after: ${DETHRACE_IDE_ARGUMENTS}")
set_target_properties(dethrace PROPERTIES
VS_DEBUGGER_COMMAND_ARGUMENTS "${DETHRACE_IDE_ARGUMENTS}"
)
endif()
3 changes: 3 additions & 0 deletions src/DETHRACE/common/car.c
Original file line number Diff line number Diff line change
Expand Up @@ -4748,6 +4748,9 @@ int CollideCamera2(br_vector3* car_pos, br_vector3* cam_pos, br_vector3* old_cam
tFace_ref face_list[3];
LOG_TRACE("(%p, %p, %p, %d)", car_pos, cam_pos, old_camera_pos, manual_move);

#ifdef DETHRACE_FIX_BUGS
ts2 = 0.f;
#endif
hither = ((br_camera*)gCamera->type_data)->hither_z * 3.0;
gCamera_has_collided = 0;
for (i = 0; i < 1; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/DETHRACE/common/displays.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void DoHeadups(tU32 pThe_time) {
}

the_headup = gHeadups;
for (i = 0; i < 15; i++) {
for (i = 0; i < COUNT_OF(gHeadups); i++) {
the_headup = &gHeadups[i];
if (the_headup->type
&& (gProgram_state.which_view == eView_forward || !the_headup->cockpit_anchored)
Expand Down
8 changes: 4 additions & 4 deletions src/DETHRACE/common/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,14 +614,14 @@ void InitializePalettes() {
gCurrent_palette_pixels = BrMemAllocate(0x400u, kMem_cur_pal_pixels);
gCurrent_palette = DRPixelmapAllocate(BR_PMT_RGBX_888, 1u, 256, gCurrent_palette_pixels, 0);
gRender_palette = BrTableFind("DRRENDER.PAL");
if (!gRender_palette) {
if (gRender_palette == NULL) {
FatalError(10);
}
gOrig_render_palette = BrPixelmapAllocateSub(gRender_palette, 0, 0, gRender_palette->width, gRender_palette->height);
gOrig_render_palette->pixels = BrMemAllocate(0x400u, kMem_render_pal_pixels);
memcpy(gOrig_render_palette->pixels, gRender_palette->pixels, 0x400u);
gFlic_palette = BrTableFind("DRACEFLC.PAL");
if (!gFlic_palette) {
if (gFlic_palette == NULL) {
FatalError(10);
}
DRSetPalette(gFlic_palette);
Expand Down Expand Up @@ -656,7 +656,7 @@ void ClearWobbles() {
LOG_TRACE("()");

for (i = 0; i < COUNT_OF(gWobble_array); ++i) {
gWobble_array[i].amplitude_x = 0.0;
gWobble_array[i].time_started = 0;
}
}

Expand Down Expand Up @@ -1690,7 +1690,7 @@ void RenderAFrame(int pDepth_mask_on) {
DrawPowerups(the_time);
}
}
if (gNet_mode) {
if (gNet_mode != eNet_mode_none) {
DisplayUserMessage();
}
if (gAction_replay_mode && !gAR_fudge_headups) {
Expand Down
Loading

0 comments on commit d3ebbb6

Please sign in to comment.