Skip to content

Commit

Permalink
windows: fixed builds
Browse files Browse the repository at this point in the history
  • Loading branch information
JaCzekanski committed Aug 14, 2019
1 parent 427dc74 commit e106b75
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .appveyor.yml
Expand Up @@ -3,14 +3,14 @@ version: '{branch}-{build}'
clone_depth: 1

environment:
PREMAKE_VERSION: 5.0.0-alpha13
SDL_VERSION: 2.0.9
PREMAKE_VERSION: 5.0.0-alpha14
SDL_VERSION: 2.0.10
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 Preview
TOOLSET: vs2017
TOOLSET: vs2019
platform: x64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 Preview
TOOLSET: vs2017
TOOLSET: vs2019
platform: Win32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: vs2017
Expand Down
10 changes: 8 additions & 2 deletions premake5.lua
Expand Up @@ -205,10 +205,16 @@ project "avocado"
}

filter {"system:windows", "not options:headless", "platforms:x86"}
libdirs "externals/SDL2/lib/x86"
libdirs {
"externals/SDL2/lib/x86",
"externals/SDL2/VisualC/Win32/Release",
}

filter {"system:windows", "not options:headless", "platforms:x64"}
libdirs "externals/SDL2/lib/x64"
libdirs {
"externals/SDL2/lib/x64",
"externals/SDL2/VisualC/x64/Release",
}


filter {"system:linux", "not options:headless"}
Expand Down
5 changes: 2 additions & 3 deletions src/device/gpu/gpu.cpp
Expand Up @@ -2,7 +2,6 @@
#include <cassert>
#include <cstdio>
#include "config.h"
#include "rectangle.h"
#include "render/render.h"
#include "utils/logic.h"
#include "utils/macros.h"
Expand Down Expand Up @@ -106,7 +105,7 @@ void GPU::drawPolygon(int16_t x[4], int16_t y[4], RGB c[4], TextureInfo t, bool
}
}

void GPU::drawRectangle(const Rectangle& rect) {
void GPU::drawRectangle(const primitive::Rect& rect) {
if (hardwareRendering) {
int x[4], y[4];
glm::ivec2 uv[4];
Expand Down Expand Up @@ -283,7 +282,7 @@ void GPU::cmdRectangle(RectangleArgs arg) {
int16_t x = extend_sign<10>(arguments[1] & 0xffff);
int16_t y = extend_sign<10>((arguments[1] & 0xffff0000) >> 16);

Rectangle rect;
primitive::Rect rect;
rect.pos = vec2(x, y);
rect.size = vec2(w, h);
rect.color = vec3((arguments[0]) & 0xff, (arguments[0] >> 8) & 0xff, (arguments[0] >> 16) & 0xff);
Expand Down
4 changes: 2 additions & 2 deletions src/device/gpu/gpu.h
Expand Up @@ -2,12 +2,12 @@
#include <array>
#include <glm/glm.hpp>
#include <vector>
#include "primitive.h"
#include "psx_color.h"
#include "registers.h"

#define VRAM ((uint16_t(*)[VRAM_WIDTH])vram.data())

struct Rectangle;
struct System;
class Render;
class OpenGL;
Expand Down Expand Up @@ -108,7 +108,7 @@ class GPU {
void cmdVramToVram(uint8_t command);

void drawPolygon(int16_t x[4], int16_t y[4], RGB c[4], TextureInfo t, bool isQuad = false, bool textured = false, int flags = 0);
void drawRectangle(const Rectangle& rect);
void drawRectangle(const primitive::Rect& rect);

void writeGP0(uint32_t data);
void writeGP1(uint32_t data);
Expand Down
6 changes: 4 additions & 2 deletions src/device/gpu/rectangle.h → src/device/gpu/primitive.h
@@ -1,7 +1,8 @@
#pragma once
#include <glm/glm.hpp>

struct Rectangle {
namespace primitive {
struct Rect {
glm::ivec2 pos;
glm::ivec2 size;
glm::ivec3 color;
Expand All @@ -15,4 +16,5 @@ struct Rectangle {
glm::ivec2 uv;
glm::ivec2 texpage; // Texture page position in VRAM (from GP0_E1)
glm::ivec2 clut; // Texture palette position in VRAM
};
};
} // namespace primitives
2 changes: 1 addition & 1 deletion src/device/gpu/render/render.h
Expand Up @@ -5,5 +5,5 @@ class Render {
public:
static void drawLine(gpu::GPU* gpu, const int16_t x[2], const int16_t y[2], const RGB c[2]);
static void drawTriangle(gpu::GPU* gpu, gpu::Vertex v[3]);
static void drawRectangle(gpu::GPU* gpu, const Rectangle& rect);
static void drawRectangle(gpu::GPU* gpu, const primitive::Rect& rect);
};
6 changes: 3 additions & 3 deletions src/device/gpu/render/render_rectangle.cpp
@@ -1,4 +1,4 @@
#include "device/gpu/rectangle.h"
#include "../primitive.h"
#include "render.h"
#include "texture_utils.h"
#include "utils/macros.h"
Expand Down Expand Up @@ -26,7 +26,7 @@ INLINE glm::uvec2 calculateTexel(glm::ivec2 tex, const gpu::GP0_E2 textureWindow
}

template <ColorDepth bits>
INLINE void rectangle(GPU* gpu, const Rectangle& rect) {
INLINE void rectangle(GPU* gpu, const primitive::Rect& rect) {
// Extract common GPU state
using Transparency = gpu::GP0_E1::SemiTransparency;
const auto transparency = gpu->gp0_e1.semiTransparency;
Expand Down Expand Up @@ -102,7 +102,7 @@ INLINE void rectangle(GPU* gpu, const Rectangle& rect) {
}
}
}
void Render::drawRectangle(gpu::GPU* gpu, const Rectangle& rect) {
void Render::drawRectangle(gpu::GPU* gpu, const primitive::Rect& rect) {
if (rect.bits == 0) {
rectangle<ColorDepth::NONE>(gpu, rect);
} else if (rect.bits == 4) {
Expand Down
3 changes: 2 additions & 1 deletion src/device/spu/voice.cpp
@@ -1,4 +1,5 @@
#include "voice.h"
#include <cmath>
#include "sound/adpcm.h"
#include "utils/math.h"

Expand Down Expand Up @@ -61,7 +62,7 @@ void Voice::processEnvelope() {
cycles *= 4;
}
if (e.direction == Dir::Decrease) {
step = static_cast<int>(static_cast<float>(step) * std::ceil(static_cast<float>(adsrVolume._reg) / static_cast<float>(0x8000)));
step = (int)(ceilf((float)adsrVolume._reg / (float)0x8000) * (float)step);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/renderer/opengl/opengl.cpp
@@ -1,10 +1,9 @@
#include "opengl.h"
#include <SDL.h>
#include <algorithm>
#include "config.h"
#include "device/gpu/gpu.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <stb_image_write.h>
#include "config.h"
#include "utils/string.h"

bool OpenGL::init() {
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/opengl/opengl.h
@@ -1,13 +1,12 @@
#pragma once
#include <opengl.h>
#include <memory>
#include "device/gpu/gpu.h"
#include "shader/buffer.h"
#include "shader/framebuffer.h"
#include "shader/program.h"
#include "shader/texture.h"

class gpu::GPU;

class OpenGL {
public:
#ifdef USE_OPENGLES
Expand Down

0 comments on commit e106b75

Please sign in to comment.