Merge remote-tracking branch 'upstream/0.6'

This commit is contained in:
Sérgio Benjamim 2018-01-24 21:48:10 -02:00
commit be5b4b11a9
11 changed files with 44 additions and 16 deletions

View File

@ -15,9 +15,13 @@ Bugfixes:
- 3DS: Fix opening files in directory names with trailing slashes
- GB MBC: Fix MBC2 saves (fixes mgba.io/i/954)
- GBA Memory: Fix copy-on-write memory leak
- Core: Fix ROM patches not being unloaded when disabled (fixes mgba.io/i/962)
- GBA I/O: Fix writing to DISPCNT CGB flag (fixes mgba.io/i/902)
- GBA Memory: Partially revert prefetch changes (fixes mgba.io/i/840)
Misc:
- GBA: Improve multiboot image detection
- GB MBC: Remove erroneous bank 0 wrapping
- 3DS: Scale font based on glyph heights (fixes mgba.io/i/961)
0.6.1: (2017-10-01)
Bugfixes:

View File

@ -211,6 +211,7 @@ elseif(UNIX)
endif()
if(NOT APPLE AND NOT HAIKU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-dirent.c)
@ -567,7 +568,7 @@ elseif(USE_ZLIB)
endif()
if (USE_LZMA)
include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/third-party/lzma)
include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/lzma)
add_definitions(-D_7ZIP_PPMD_SUPPPORT)
list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-lzma.c)
set(LZMA_SRC

View File

@ -253,10 +253,10 @@ bool mCheatSaveFile(struct mCheatDevice* device, struct VFile* vf) {
}
void mCheatRefresh(struct mCheatDevice* device, struct mCheatSet* cheats) {
cheats->refresh(cheats, device);
if (!cheats->enabled) {
return;
}
cheats->refresh(cheats, device);
size_t elseLoc = 0;
size_t endLoc = 0;

View File

@ -229,7 +229,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
AVDictionary* opts = 0;
av_dict_set(&opts, "strict", "-2", 0);
if (encoder->context->oformat->flags & AVFMT_GLOBALHEADER) {
#ifdef AV_CODEC_FLAG_GLOBAL_HEADER
encoder->audio->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
#else
encoder->audio->flags |= CODEC_FLAG_GLOBAL_HEADER;
#endif
}
avcodec_open2(encoder->audio, acodec, &opts);
av_dict_free(&opts);
@ -291,7 +295,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
encoder->video->gop_size = 60;
encoder->video->max_b_frames = 3;
if (encoder->context->oformat->flags & AVFMT_GLOBALHEADER) {
#ifdef AV_CODEC_FLAG_GLOBAL_HEADER
encoder->video->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
#else
encoder->video->flags |= CODEC_FLAG_GLOBAL_HEADER;
#endif
}
if (strcmp(vcodec->name, "libx264") == 0) {
// Try to adaptively figure out when you can use a slower encoder

View File

@ -244,7 +244,11 @@ bool GBCheatAddLine(struct mCheatSet* set, const char* line, int type) {
static void GBCheatRefresh(struct mCheatSet* cheats, struct mCheatDevice* device) {
struct GBCheatSet* gbset = (struct GBCheatSet*) cheats;
_patchROM(device, gbset);
if (cheats->enabled) {
_patchROM(device, gbset);
} else {
_unpatchROM(device, gbset);
}
}
static void GBCheatSetCopyProperties(struct mCheatSet* set, struct mCheatSet* oldSet) {

View File

@ -274,7 +274,11 @@ bool GBACheatAddLine(struct mCheatSet* set, const char* line, int type) {
static void GBACheatRefresh(struct mCheatSet* cheats, struct mCheatDevice* device) {
struct GBACheatSet* gbaset = (struct GBACheatSet*) cheats;
_patchROM(device, gbaset);
if (cheats->enabled) {
_patchROM(device, gbaset);
} else {
_unpatchROM(device, gbaset);
}
}
static void GBACheatSetCopyProperties(struct mCheatSet* set, struct mCheatSet* oldSet) {

View File

@ -171,11 +171,16 @@ static uint16_t* _vramBlock(struct mVideoLogger* logger, uint32_t address) {
uint16_t GBAVideoProxyRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) {
struct GBAVideoProxyRenderer* proxyRenderer = (struct GBAVideoProxyRenderer*) renderer;
switch (address) {
case REG_DISPCNT:
value &= 0xFFF7;
break;
case REG_BG0CNT:
case REG_BG1CNT:
value &= 0xDFFF;
break;
case REG_BG2CNT:
case REG_BG3CNT:
value &= 0xFFCF;
value &= 0xFFFF;
break;
case REG_BG0HOFS:
case REG_BG0VOFS:

View File

@ -1506,8 +1506,8 @@ int32_t GBAMemoryStall(struct ARMCore* cpu, int32_t wait) {
maxLoads -= previousLoads;
}
int32_t s = cpu->memory.activeSeqCycles16;
int32_t n2s = cpu->memory.activeNonseqCycles16 - cpu->memory.activeSeqCycles16;
int32_t s = cpu->memory.activeSeqCycles16 + 1;
int32_t n2s = cpu->memory.activeNonseqCycles16 - cpu->memory.activeSeqCycles16 + 1;
// Figure out how many sequential loads we can jam in
int32_t stall = s;
@ -1528,7 +1528,7 @@ int32_t GBAMemoryStall(struct ARMCore* cpu, int32_t wait) {
memory->lastPrefetchedPc = cpu->gprs[ARM_PC] + WORD_SIZE_THUMB * (loads + previousLoads - 1);
// The next |loads|S waitstates disappear entirely, so long as they're all in a row
cpu->cycles -= stall;
cpu->cycles -= (s - 1) * loads;
return wait;
}

View File

@ -147,6 +147,7 @@ static uint16_t GBAVideoSoftwareRendererWriteVideoRegister(struct GBAVideoRender
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
switch (address) {
case REG_DISPCNT:
value &= 0xFFF7;
softwareRenderer->dispcnt = value;
GBAVideoSoftwareRendererUpdateDISPCNT(softwareRenderer);
break;

View File

@ -216,6 +216,9 @@ static void GBAVideoDummyRendererDeinit(struct GBAVideoRenderer* renderer) {
static uint16_t GBAVideoDummyRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) {
UNUSED(renderer);
switch (address) {
case REG_DISPCNT:
value &= 0xFFF7;
break;
case REG_BG0CNT:
case REG_BG1CNT:
value &= 0xDFFF;

View File

@ -11,13 +11,12 @@
#include "ctr-gpu.h"
#define CELL_HEIGHT 16
#define CELL_WIDTH 16
#define FONT_SIZE 0.52f
#define FONT_SIZE 15.6f
struct GUIFont {
C3D_Tex* sheets;
C3D_Tex icons;
float size;
};
struct GUIFont* GUIFontCreate(void) {
@ -29,6 +28,7 @@ struct GUIFont* GUIFontCreate(void) {
C3D_Tex* tex;
TGLP_s* glyphInfo = fontGetGlyphInfo();
guiFont->size = FONT_SIZE / glyphInfo->cellHeight;
guiFont->sheets = malloc(sizeof(*guiFont->sheets) * glyphInfo->nSheets);
int i;
@ -59,16 +59,14 @@ void GUIFontDestroy(struct GUIFont* font) {
}
unsigned GUIFontHeight(const struct GUIFont* font) {
UNUSED(font);
return fontGetInfo()->lineFeed * FONT_SIZE;
return fontGetInfo()->lineFeed * font->size;
}
unsigned GUIFontGlyphWidth(const struct GUIFont* font, uint32_t glyph) {
UNUSED(font);
int index = fontGlyphIndexFromCodePoint(glyph);
charWidthInfo_s* info = fontGetCharWidthInfo(index);
if (info) {
return info->charWidth * FONT_SIZE;
return info->charWidth * font->size;
}
return 0;
}
@ -108,7 +106,7 @@ void GUIFontDrawGlyph(const struct GUIFont* font, int glyph_x, int glyph_y, uint
u16 v = tex->height * data.texcoord.bottom;
ctrAddRectEx(color, x, y,
tex->width * width * FONT_SIZE, tex->height * height * -FONT_SIZE,
tex->width * width * font->size, tex->height * height * -font->size,
u, v, tex->width * width, tex->height * height, 0);
}