Skip to content

Commit

Permalink
Merge pull request flyinghead#1523 from reicast/fh/master-merge
Browse files Browse the repository at this point in the history
Tons of fixes, much improved naomi support, atomiswave support, imgui UI, arm64 dynarec, improved x64 dynarec, dsp interpreter + arm64 + x64, others
  • Loading branch information
skmp authored Mar 27, 2019
2 parents 69ab16a + 1ef8caf commit 2cf59b4
Show file tree
Hide file tree
Showing 510 changed files with 323,688 additions and 18,798 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,28 @@ DerivedData
*.hmap
emulator.xccheckout
reicast.xccheckout
build/*
*.so
*Karen_angelXwind*
local.properties
ant.properties
*build_obj
*.d
Workdir/data
Workdir/reicast*
Workdir/vmu*
Workdir/webui*
Workdir/emu.cfg
Workdir/lib*ant.properties
reicast-ios.xccheckout

# Linux General
shell/linux/.map
shell/linux/nosym-reicast.elf
shell/linux/reicast.elf
shell/linux/reicast_naomi.elf
shell/linux/reicast_awave.elf
shell/linux/dispframe.elf

# Visual Studio
generated
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ script:
before_deploy:
- cd ../../
- mkdir -p artifacts/$GIT_BUILD/
- cp shell/android-studio/reicast/build/outputs/apk/debug/reicast-debug.apk artifacts/$GIT_BUILD/reicast-android-debug-$GIT_HASH.apk
- cp shell/android-studio/reicast/build/outputs/apk/dreamcast/debug/reicast-dreamcast-debug.apk artifacts/$GIT_BUILD/reicast-android-debug-$GIT_HASH.apk
deploy:
provider: s3
access_key_id: AKIAJR5J3OHAQUP5BHHQ
Expand Down
36 changes: 18 additions & 18 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
version: git-{branch}-{build}
os: Visual Studio 2015
image: Visual Studio 2017

environment:
matrix:
- Toolset: v140
- EXTRA_PATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin\
LAUNCH_BUILD: mingw32-make platform=win32
LAUNCH_PATH: shell\linux\

platform:
- x86
- x64

configuration:
- Release-140
# - Debug-140
build_script:
- cmd: >-
set PATH=%EXTRA_PATH%;%PATH%
cd %LAUNCH_PATH%
%LAUNCH_BUILD%
build:
project: shell/reicast.sln
parallel: true
verbosity: minimal

after_build:
- cmd: cd ..\..
- cmd: mkdir artifacts
- cmd: set PLATFORM2=%PLATFORM:x86=Win32%
- cmd: move WorkDir\reicast_%PLATFORM2%_%CONFIGURATION%.exe artifacts/reicast-win_%PLATFORM%-%CONFIGURATION%-%APPVEYOR_REPO_COMMIT%.exe
- cmd: move shell\linux\reicast.exe artifacts/reicast-win_x64-fast-%APPVEYOR_REPO_COMMIT%.exe
- cmd: copy %EXTRA_PATH%\libgcc_s_seh-1.dll artifacts
- cmd: copy %EXTRA_PATH%\libwinpthread-1.dll artifacts
- cmd: copy %EXTRA_PATH%\libgomp-1.dll artifacts

artifacts:
- path: artifacts
name: reicast-win_$(platform)-$(configuration)-$(APPVEYOR_REPO_COMMIT)
name: reicast-win_x64-fast-$(APPVEYOR_REPO_COMMIT)

deploy:
- provider: S3
Expand All @@ -35,5 +35,5 @@ deploy:
region: eu-west-1
bucket: reicast-builds-windows
folder: 'builds/heads/$(APPVEYOR_REPO_BRANCH)-$(APPVEYOR_REPO_COMMIT)'
artifact: reicast-win_$(platform)-$(configuration)-$(APPVEYOR_REPO_COMMIT)
artifact: reicast-win_x64-fast-$(APPVEYOR_REPO_COMMIT)
set_public: true
94 changes: 94 additions & 0 deletions core/archive/7zArchive.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
Created on: Nov 22, 2018
Copyright 2018 flyinghead
This file is part of reicast.
reicast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
reicast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "7zArchive.h"
#include "deps/lzma/7z.h"
#include "deps/lzma/7zCrc.h"
#include "deps/lzma/Alloc.h"

#define kInputBufSize ((size_t)1 << 18)

static bool crc_tables_generated;

bool SzArchive::Open(const char* path)
{
SzArEx_Init(&szarchive);

if (InFile_Open(&archiveStream.file, path))
return false;
FileInStream_CreateVTable(&archiveStream);
LookToRead2_CreateVTable(&lookStream, false);
lookStream.buf = (Byte *)ISzAlloc_Alloc(&g_Alloc, kInputBufSize);
if (lookStream.buf == NULL)
return false;
lookStream.bufSize = kInputBufSize;
lookStream.realStream = &archiveStream.vt;
LookToRead2_Init(&lookStream);

if (!crc_tables_generated)
{
CrcGenerateTable();
crc_tables_generated = true;
}
SRes res = SzArEx_Open(&szarchive, &lookStream.vt, &g_Alloc, &g_Alloc);

return (res == SZ_OK);
}

ArchiveFile* SzArchive::OpenFile(const char* name)
{
u16 fname[512];
for (int i = 0; i < szarchive.NumFiles; i++)
{
unsigned isDir = SzArEx_IsDir(&szarchive, i);
if (isDir)
continue;

int len = SzArEx_GetFileNameUtf16(&szarchive, i, fname);
char szname[512];
int j = 0;
for (; j < len && j < sizeof(szname) - 1; j++)
szname[j] = fname[j];
szname[j] = 0;
if (strcmp(name, szname))
continue;

size_t offset = 0;
size_t out_size_processed = 0;
SRes res = SzArEx_Extract(&szarchive, &lookStream.vt, i, &block_idx, &out_buffer, &out_buffer_size, &offset, &out_size_processed, &g_Alloc, &g_Alloc);
if (res != SZ_OK)
return NULL;

return new SzArchiveFile(out_buffer, offset, (u32)out_size_processed);
}
return NULL;
}

SzArchive::~SzArchive()
{
if (lookStream.buf != NULL)
{
File_Close(&archiveStream.file);
ISzAlloc_Free(&g_Alloc, lookStream.buf);
if (out_buffer != NULL)
ISzAlloc_Free(&g_Alloc, out_buffer);
SzArEx_Free(&szarchive, &g_Alloc);
}
}
69 changes: 69 additions & 0 deletions core/archive/7zArchive.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Created on: Nov 23, 2018
Copyright 2018 flyinghead
This file is part of reicast.
reicast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
reicast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef CORE_ARCHIVE_7ZARCHIVE_H_
#define CORE_ARCHIVE_7ZARCHIVE_H_

#include "archive.h"
#include "deps/lzma/7z.h"
#include "deps/lzma/7zFile.h"

class SzArchive : public Archive
{
public:
SzArchive() : out_buffer(NULL) {
memset(&archiveStream, 0, sizeof(archiveStream));
memset(&lookStream, 0, sizeof(lookStream));
}
virtual ~SzArchive();

virtual ArchiveFile* OpenFile(const char* name) override;

private:
virtual bool Open(const char* path) override;

CSzArEx szarchive;
UInt32 block_idx; /* it can have any value before first call (if outBuffer = 0) */
Byte *out_buffer; /* it must be 0 before first call for each new archive. */
size_t out_buffer_size; /* it can have any value before first call (if outBuffer = 0) */
CFileInStream archiveStream;
CLookToRead2 lookStream;

};

class SzArchiveFile : public ArchiveFile
{
public:
SzArchiveFile(u8 *data, u32 offset, u32 length) : data(data), offset(offset), length(length) {}
virtual u32 Read(void *buffer, u32 length) override
{
length = min(length, this->length);
memcpy(buffer, data + offset, length);
return length;
}

private:
u8 *data;
u32 offset;
u32 length;
};

#endif /* CORE_ARCHIVE_7ZARCHIVE_H_ */
46 changes: 46 additions & 0 deletions core/archive/ZipArchive.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Created on: Nov 23, 2018
Copyright 2018 flyinghead
This file is part of reicast.
reicast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
reicast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ZipArchive.h"

ZipArchive::~ZipArchive()
{
zip_close(zip);
}

bool ZipArchive::Open(const char* path)
{
zip = zip_open(path, 0, NULL);
return (zip != NULL);
}

ArchiveFile* ZipArchive::OpenFile(const char* name)
{
zip_file *zip_file = zip_fopen(zip, name, 0);
if (zip_file == NULL)
return NULL;

return new ZipArchiveFile(zip_file);
}

u32 ZipArchiveFile::Read(void* buffer, u32 length)
{
return zip_fread(zip_file, buffer, length);
}
52 changes: 52 additions & 0 deletions core/archive/ZipArchive.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
Created on: Nov 23, 2018
Copyright 2018 flyinghead
This file is part of reicast.
reicast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
reicast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef CORE_ARCHIVE_ZIPARCHIVE_H_
#define CORE_ARCHIVE_ZIPARCHIVE_H_
#include "archive.h"
#include "deps/libzip/zip.h"

class ZipArchive : public Archive
{
public:
ZipArchive() : zip(NULL) {}
virtual ~ZipArchive();

virtual ArchiveFile* OpenFile(const char* name) override;

private:
virtual bool Open(const char* path) override;

struct zip *zip;
};

class ZipArchiveFile : public ArchiveFile
{
public:
ZipArchiveFile(struct zip_file *zip_file) : zip_file(zip_file) {}
virtual ~ZipArchiveFile() { zip_fclose(zip_file); }
virtual u32 Read(void* buffer, u32 length) override;

private:
struct zip_file *zip_file;
};

#endif /* CORE_ARCHIVE_ZIPARCHIVE_H_ */
Loading

0 comments on commit 2cf59b4

Please sign in to comment.