Unverified Commit 14a66ea2 authored by Rob Loach's avatar Rob Loach Committed by GitHub
Browse files

Merge pull request #316 from libretro/dev

0.26.1
parents 9b953100 e4aa141b
......@@ -4,6 +4,14 @@ All notable changes to [ChaiLove](https://github.com/RobLoach/ChaiLove) will be
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## 0.26.1 - 2018-09-19
### Fixes
- Fixed `mount()` with relative paths
- Fixed mounting of saves and system directories
- Fix for compiling `nearest_resampler.c` without `STATIC_LINKING` ([#312](https://github.com/libretro/libretro-chailove/pull/312))
- By [@twinaphex](https://github.com/twinaphex)
- Fix rewind by removing compression of save states
## 0.26.0 - 2018-09-13
### Features
- Added a global `require()` function to load modules ([#308](https://github.com/libretro/libretro-chailove/pull/308))
......
......@@ -48,7 +48,6 @@ ifneq ($(STATIC_LINKING), 1)
)
endif
# stb_vorbis
#SOURCES_C += $(CORE_DIR)/vendor/stb/stb_vorbis.c
FLAGS += -DHAVE_STB_VORBIS
......
......@@ -23,7 +23,7 @@ PROJECT_NAME = "ChaiLove API"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = "0.26.0"
PROJECT_NUMBER = "0.26.1"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
......
......@@ -47,7 +47,7 @@ global T
def conf(t) {
t.window.width = WIDTH * gridScale
t.window.height = HEIGHT * gridScale
t.version = "0.26.0"
t.version = "0.26.1"
}
/**
......
......@@ -56,7 +56,7 @@ void ChaiLove::quit(void) {
window.unload();
}
bool ChaiLove::load(const std::string& file) {
bool ChaiLove::load(const std::string& file, const void* data) {
// Display a welcome message from ChaiLove.
#ifndef GIT_VERSION
#define GIT_VERSION ""
......@@ -68,7 +68,7 @@ bool ChaiLove::load(const std::string& file) {
sound.load();
// Initalize the file system.
bool loaded = filesystem.init(file);
bool loaded = filesystem.init(file, data);
if (!loaded) {
std::cout << "[ChaiLove] [filesystem] Error loading " << file << std::endl;
return false;
......
......@@ -48,8 +48,8 @@
#define CHAILOVE_VERSION_MAJOR 0
#define CHAILOVE_VERSION_MINOR 26
#define CHAILOVE_VERSION_PATCH 0
#define CHAILOVE_VERSION_STRING "0.26.0"
#define CHAILOVE_VERSION_PATCH 1
#define CHAILOVE_VERSION_STRING "0.26.1"
#include "SDL.h"
#include "libretro.h"
......@@ -105,7 +105,7 @@ class ChaiLove {
~ChaiLove();
void quit(void);
bool load(const std::string& file);
bool load(const std::string& file, const void* data);
void update();
void draw();
void reset();
......
......@@ -328,7 +328,7 @@ bool retro_load_game(const struct retro_game_info *info) {
if (gamePath == ".") {
gamePath = "main.chai";
}
return ChaiLove::getInstance()->load(gamePath);
return ChaiLove::getInstance()->load(gamePath, info->data);
}
/**
......
......@@ -19,7 +19,7 @@ namespace love {
*
* @code
* def conf(t) {
* t.version = "0.26.0" // Version of ChaiLove
* t.version = "0.26.1" // Version of ChaiLove
* t.identity = "mygame" // Machine name of your game
* t.window.title = "My Game" // Human-readable name
* t.window.width = 1024 // Game width
......
......@@ -17,7 +17,7 @@ namespace love {
/**
* Initialize the file system.
*/
bool filesystem::init(const std::string& file) {
bool filesystem::init(const std::string& file, const void* data) {
if (PHYSFS_isInit() == 0) {
// Initialize PhysFS
if (PHYSFS_init(NULL) == 0) {
......@@ -57,16 +57,16 @@ void filesystem::mountlibretro() {
const char *assets_dir = NULL;
const char *save_dir = NULL;
if (ChaiLove::environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &system_dir) && system_dir) {
mount(system_dir, "libretro/system");
mount(system_dir, "/libretro/system");
}
if (ChaiLove::environ_cb(RETRO_ENVIRONMENT_GET_CORE_ASSETS_DIRECTORY, &assets_dir) && assets_dir) {
mount(assets_dir, "libretro/assets");
mount(assets_dir, "/libretro/assets");
}
if (ChaiLove::environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &save_dir) && save_dir) {
save_dir = *save_dir ? save_dir : system_dir;
mount(save_dir, "libretro/saves");
mount(save_dir, "/libretro/saves");
} else {
mount(save_dir = system_dir, "libretro/saves");
mount(save_dir = system_dir, "/libretro/saves");
}
// Ensure the write directory is set to the Save Directory.
......@@ -227,13 +227,44 @@ bool filesystem::mount(const std::string& archive, const std::string& mountpoint
if (archive.length() <= 0 || mountpoint.length() <= 0) {
return false;
}
// Display a message.
std::cout << "[ChaiLove] [filesystem] Mounting " << archive << " as " << mountpoint << std::endl;
int returnValue = PHYSFS_mount(archive.c_str(), mountpoint.c_str(), 0);
if (returnValue == 0) {
std::cout << "[ChaiLove] [filesystem] Error mounting: " << getLastError() << std::endl;
// Use the simple mount method if we're mounting the root directory.
if (mountpoint == "/") {
int returnValue = PHYSFS_mount(archive.c_str(), mountpoint.c_str(), 0);
if (returnValue == 0) {
std::cout << "[ChaiLove] [filesystem] Error mounting /: " << getLastError() << std::endl;
return false;
}
return true;
}
// See if we're mounting a file.
if (isFile(archive)) {
// Mount using a handle instead, since we're doing another archive.
PHYSFS_File* file = openFile(archive);
if (file != NULL) {
if (PHYSFS_mountHandle(file, archive.c_str(), mountpoint.c_str(), 1) == 0) {
std::cout << "[ChaiLove] [filesystem] Error mounting file: " << getLastError() << std::endl;
return false;
}
return true;
}
return false;
}
return true;
// Check if we're mounting a directory.
if (isDirectory(archive)) {
int returnVal = PHYSFS_mount(archive.c_str(), mountpoint.c_str(), 0);
if (returnVal == 0) {
std::cout << "[ChaiLove] [filesystem] Error mounting directory: " << getLastError() << std::endl;
return false;
}
return true;
}
return false;
}
/**
......
......@@ -35,7 +35,7 @@ class filesystem {
bool load(const std::string& file);
void mountlibretro();
bool init(const std::string& file);
bool init(const std::string& file, const void* data);
bool unload();
SDL_RWops* openRW(const std::string& filename);
char* readChar(const std::string& filename);
......
......@@ -53,7 +53,7 @@ class script {
* t.console = false
*
* // The ChaiLove version this game was made for.
* t.version = "0.26.0"
* t.version = "0.26.1"
*
* // The width and height of the game.
* t.window.width = 1024
......
......@@ -15,7 +15,7 @@ def conf(t) {
t.window.width = 460
t.window.height = 320
t.console = true
t.version = "0.26.0"
t.version = "0.26.1"
}
def load() {
......
......@@ -65,8 +65,7 @@ var writeFileReturn = love.filesystem.write("test/createDirectoryTest/test.md",
assert(writeFileReturn, "love.filesystem.write()")
// mount()
// @TODO: Figure out how to have the mount() point be relative to the origin.
var mountResult = love.filesystem.mount("test/unittests/assets/hello.zip", "hello")
var mountResult = love.filesystem.mount("assets/hello.zip", "hello")
assert(mountResult, "love.filesystem.mount()")
// mount() - Load
......@@ -74,11 +73,11 @@ var mountLoadResult = love.filesystem.read("hello/hello.txt")
var mountLoadResultType = is_type(mountLoadResult, "string")
assert(mountLoadResultType, " read()")
if (mountLoadResultType) {
assert_equal(mountLoadResult.trim(), "Hello World!", " contents")
assert_equal(mountLoadResult.trim(), "Hello World!", " contents")
}
// unmount()
love.filesystem.unmount("test/unittests/assets/hello.zip")
love.filesystem.unmount("assets/hello.zip")
assert_not(love.filesystem.exists("hello/hello.txt"), "love.filesystem.unmount()")
// require()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment