Skip to content

Commit

Permalink
Update to v094r38 release.
Browse files Browse the repository at this point in the history
byuu says:

I'll post more detailed changes later, but basically:
- fixed Baldur's Gate bug
- guess if no flash ROM ID present (fixes Magical Vacation, many many
  others)
- nall cleanups
- sfc/cartridge major cleanups
- bsxcartridge/"bsx" renamed to mcc/"mcc" after the logic chip it uses
  (consistency with SGB/ICD2)
- ... and more!
  • Loading branch information
Screwtapello committed Aug 4, 2015
1 parent 092cac9 commit 1b0b54a
Show file tree
Hide file tree
Showing 81 changed files with 1,202 additions and 1,267 deletions.
2 changes: 1 addition & 1 deletion emulator/emulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace nall;

namespace Emulator {
static const string Name = "higan";
static const string Version = "094.37";
static const string Version = "094.38";
static const string Author = "byuu";
static const string License = "GPLv3";
static const string Website = "http://byuu.org/";
Expand Down
4 changes: 2 additions & 2 deletions gba/apu/fifo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ void APU::FIFO::read() {
}

void APU::FIFO::write(int8 byte) {
if(size == 32) return;
size++;
if(size == 32) rdoffset++;
else size++;
sample[wroffset++] = byte;
}

Expand Down
5 changes: 5 additions & 0 deletions gba/cartridge/cartridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ void Cartridge::load() {
flashrom.size = info["size"].decimal();
for(unsigned n = 0; n < flashrom.size; n++) flashrom.data[n] = 0xff;

//if FlashROM ID not provided; guess that it's a Macronix chip
//this will not work for all games; in which case, the ID must be specified manually
if(!flashrom.id && flashrom.size == 64 * 1024) flashrom.id = 0x1cc2;
if(!flashrom.id && flashrom.size == 128 * 1024) flashrom.id = 0x09c2;

interface->loadRequest(ID::FlashROM, info["name"].text());
memory.append({ID::FlashROM, info["name"].text()});
}
Expand Down
8 changes: 4 additions & 4 deletions hiro/components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@
#define Hiro_CheckButton
#define Hiro_CheckLabel
#define Hiro_ComboButton
#define Hiro_Console
//#define Hiro_Console
#define Hiro_Frame
#define Hiro_HexEdit
#define Hiro_HorizontalScroller
#define Hiro_HorizontalSlider
#define Hiro_IconView
//#define Hiro_IconView
#define Hiro_Label
#define Hiro_LineEdit
#define Hiro_ListView
#define Hiro_ProgressBar
#define Hiro_RadioButton
#define Hiro_RadioLabel
#define Hiro_SourceView
//#define Hiro_SourceView
#define Hiro_TabFrame
#define Hiro_TextEdit
#define Hiro_TreeView
//#define Hiro_TreeView
#define Hiro_VerticalScroller
#define Hiro_VerticalSlider
#define Hiro_Viewport
Expand Down
18 changes: 9 additions & 9 deletions hiro/extension/browser-dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ struct BrowserDialogWindow {
private:
Window window;
VerticalLayout layout{&window};
HorizontalLayout pathLayout{&layout, Size{~0, 0}, 8};
HorizontalLayout pathLayout{&layout, Size{~0, 0}, 5};
LineEdit pathName{&pathLayout, Size{~0, 0}, 0};
Button pathHome{&pathLayout, Size{0, 0}, 0};
Button pathRefresh{&pathLayout, Size{0, 0}, 0};
Button pathUp{&pathLayout, Size{0, 0}, 0};
ListView view{&layout, Size{~0, ~0}, 8};
ListView view{&layout, Size{~0, ~0}, 5};
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
ComboButton filterList{&controlLayout, Size{120, 0}, 8};
LineEdit fileName{&controlLayout, Size{~0, 0}, 8};
Button acceptButton{&controlLayout, Size{80, 0}, 8};
Button cancelButton{&controlLayout, Size{80, 0}, 8};
ComboButton filterList{&controlLayout, Size{120, 0}, 5};
LineEdit fileName{&controlLayout, Size{~0, 0}, 5};
Button acceptButton{&controlLayout, Size{80, 0}, 5};
Button cancelButton{&controlLayout, Size{80, 0}, 5};

BrowserDialog::State& state;
vector<lstring> filters;
Expand Down Expand Up @@ -116,7 +116,7 @@ auto BrowserDialogWindow::isMatch(const string& name) -> bool {
auto BrowserDialogWindow::run() -> lstring {
state.response.reset();

layout.setMargin(8);
layout.setMargin(5);
pathName.onActivate([&] { setPath(pathName.text()); });
pathHome.setBordered(false).setIcon(Icon::Go::Home).onActivate([&] { setPath(userpath()); });
pathRefresh.setBordered(false).setIcon(Icon::Action::Refresh).onActivate([&] { setPath(state.path); });
Expand Down Expand Up @@ -175,7 +175,7 @@ auto BrowserDialogWindow::setPath(string path) -> void {

view.append(ListViewItem()
.append(ListViewCell().setText(content).setIcon(Icon::Emblem::Folder))
.append(ListViewCell().setText(octal(storage::mode({path, content}) & 0777, 3L)))
.append(ListViewCell().setText(octal(file_system_object::mode({path, content}) & 0777, 3L)))
);
}

Expand All @@ -186,7 +186,7 @@ auto BrowserDialogWindow::setPath(string path) -> void {

view.append(ListViewItem()
.append(ListViewCell().setText(content).setIcon(folderMode ? Icon::Action::Open : Icon::Emblem::File))
.append(ListViewCell().setText(octal(storage::mode({path, content}) & 0777, 3L)))
.append(ListViewCell().setText(octal(file_system_object::mode({path, content}) & 0777, 3L)))
);
}

Expand Down
12 changes: 6 additions & 6 deletions hiro/extension/message-dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@ auto MessageDialog::warning(const lstring& buttons) -> string {
auto MessageDialog::_run() -> string {
Window window;
VerticalLayout layout{&window};
HorizontalLayout messageLayout{&layout, Size{~0, 0}, 8};
Canvas messageIcon{&messageLayout, Size{16, 16}, 8};
HorizontalLayout messageLayout{&layout, Size{~0, 0}, 5};
Canvas messageIcon{&messageLayout, Size{16, 16}, 5};
Label messageText{&messageLayout, Size{~0, 0}};
HorizontalLayout controlLayout{&layout, Size{~0, 0}};
Widget controlSpacer{&controlLayout, Size{~0, 0}};

layout.setMargin(8);
layout.setMargin(5);
messageIcon.setIcon(state.icon);
messageText.setText(state.text);
for(auto n : range(state.buttons)) {
Button button{&controlLayout, Size{80, 0}, 8};
Button button{&controlLayout, Size{80, 0}, 5};
button.onActivate([&, n] { state.response = state.buttons[n]; window.setModal(false); });
button.setText(state.buttons[n]);
button.setFocused(); //the last button will have effective focus
}

signed widthMessage = 8 + 16 + 8 + Font::size(Font::sans(), state.text).width() + 8;
signed widthButtons = 8 + state.buttons.size() * 88;
signed widthMessage = 5 + 16 + 5 + Font::size(Font::sans(), state.text).width() + 5;
signed widthButtons = 5 + state.buttons.size() * 85;
signed width = max(320, widthMessage, widthButtons);

window.onClose([&] { window.setModal(false); });
Expand Down
8 changes: 8 additions & 0 deletions nall/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ ifeq ($(platform),bsd)
link += -Wl,-rpath=/usr/local/lib/gcc49
endif
# threading support
ifeq ($(threaded),true)
ifneq ($(filter $(platform),linux bsd),)
flags += -pthread
link += -lrt
endif
endif
# cross-compilation support
ifeq ($(arch),x86)
flags := -m32 $(flags)
Expand Down
5 changes: 5 additions & 0 deletions nall/any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ struct any {
return static_cast<holder<typename remove_reference<T>::type>*>(container)->value;
}

template<typename T> auto get(const T& fallback) const -> const T& {
if(!is<T>()) return fallback;
return static_cast<holder<typename remove_reference<T>::type>*>(container)->value;
}

template<typename T> auto operator=(const T& value) -> any& {
using auto_t = type_if<is_array<T>, typename remove_extent<typename add_const<T>::type>::type*, T>;

Expand Down
137 changes: 0 additions & 137 deletions nall/base64.hpp

This file was deleted.

49 changes: 31 additions & 18 deletions nall/beat/archive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,26 @@ auto Archive::create(const string& beatname, const string& pathname, const strin
scan(contents, pathname, pathname);

for(auto& name : contents) {
if(name.endsWith("/")) {
name.rtrim("/");
beat.writevu(0 | ((name.length() - 1) << 1));
beat.writes(name);
} else {
File input{{pathname, name}, file::mode::read};
if(!input) return false;

beat.writevu(1 | ((name.length() - 1) << 1));
beat.writes(name);
string location{pathname, name};
bool directory = name.endsWith("/");
bool readable = file_system_object::readable(location);
bool writable = file_system_object::writable(location);
bool executable = file_system_object::executable(location);
unsigned info = directory << 0 | readable << 1 | writable << 2 | executable << 3 | (name.rtrim("/").size() - 1) << 4;

beat.writevu(info);
beat.writes(name);
if(directory) continue;

File input{location, file::mode::read};
if(input) {
auto size = input.size();
beat.writevu(size);
while(size--) beat.write(input.read());
beat.writel(input.checksum.value(), 4);
} else {
beat.writevu(0);
beat.writel(0x00000000, 4);
}
}

Expand All @@ -61,14 +67,20 @@ auto Archive::unpack(const string& beatname, const string& pathname) -> bool {

directory::create(pathname);
while(beat.offset() < beat.size() - 4) {
auto data = beat.readvu();
auto name = beat.reads((data >> 1) + 1);
auto info = beat.readvu();
auto name = beat.reads((info >> 4) + 1);
if(name.find("\\") || name.find("../")) return false; //block path exploits

if((data & 1) == 0) {
directory::create({pathname, name});
string location{pathname, name};
bool directory = info & 1;
bool readable = info & 2;
bool writable = info & 4;
bool executable = info & 8;

if(directory) {
if(!nall::directory::create(location)) return false;
} else {
File output{{pathname, name}, file::mode::write};
File output{location, file::mode::write};
if(!output) return false;

auto size = beat.readvu();
Expand All @@ -90,9 +102,10 @@ auto Archive::extract(const string& beatname, const string& filename) -> vector<
beat.seek(beat.offset() + size);

while(beat.offset() < beat.size() - 4) {
auto data = beat.readvu();
auto name = beat.reads((data >> 1) + 1);
if((data & 1) == 0) continue;
auto info = beat.readvu();
auto name = beat.reads((info >> 4) + 1);
if(info & 1) continue; //ignore directories

auto size = beat.readvu();
if(name != filename) {
beat.seek(beat.offset() + size + 4);
Expand Down
2 changes: 1 addition & 1 deletion nall/beat/multi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct bpsmulti {
string readString(unsigned length) {
string text;
text.resize(length + 1);
char* p = text.pointer();
char* p = text.get();
while(length--) *p++ = read();
return text;
}
Expand Down
Loading

0 comments on commit 1b0b54a

Please sign in to comment.