Readme changes, github actions ci, test (#1)

* Readme changes, github actions ci, test

* Std flag change for older GCC versions"

* Install gcc multilib

* test fix and formatting

* Don't segfault on nonexistant file and show error instead

* Update ci.yml

* PR comments

* remove silly bit
This commit is contained in:
Ethan Roseman 2022-06-30 15:23:00 -04:00 committed by GitHub
parent f11759cc71
commit d92f0d1d08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 6 deletions

23
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: CI
on: [push, pull_request]
jobs:
build_and_test:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install GCC multilib
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
- name: Build
run: make -j
- name: Test
run: |
wget https://cdn.discordapp.com/attachments/727918646525165659/917185027656286218/GC_WII_COMPILERS.zip
unzip GC_WII_COMPILERS.zip
MWCIncludes=. ./wibo GC/2.7/mwcceppc.exe -c test/test.c
file test.o

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
wibo wibo
build/ build/
*.o
.vscode/

View File

@ -1,6 +1,6 @@
all: wibo all: wibo
CXXFLAGS = -Wall -g -m32 -std=c++20 -lstdc++ -MD CXXFLAGS = -Wall -g -m32 -std=c++2a -lstdc++ -MD
BUILD_DIR := build BUILD_DIR := build
CPP_FILES := $(wildcard *.cpp) CPP_FILES := $(wildcard *.cpp)

View File

@ -1,20 +1,22 @@
# WiBo # WiBo
An experiment to try and write a minimal, low-fuss wrapper that can run really simple command-line 32-bit Windows binaries on Linux - with less faff and less dependencies than WINE. A minimal, low-fuss wrapper that can run really simple command-line 32-bit Windows binaries on Linux - with less faff and less dependencies than WINE.
Don't run this on any untrusted executables, I implore you. (Or probably just don't run it at all... :p) Don't run this on any untrusted executables, I implore you. (Or probably just don't run it at all... :p)
make && ./wibo make && ./wibo
If you need something like this project (but more mature), you might find [taviso/loadlibrary](https://github.com/taviso/loadlibrary) more interesting.
--- ---
Rough to-do list: Rough to-do list:
- Implement more APIs - Implement more APIs
- Do something intelligent with Windows `HANDLE`s - Do something intelligent with Windows `HANDLE`s
- Pass the command line properly
- Convert paths in environment variables (and the structure of `PATH` itself, maybe) to Windows format - Convert paths in environment variables (and the structure of `PATH` itself, maybe) to Windows format
- Implement PE relocations rather than just failing unceremoniously - Implement PE relocations rather than just failing unceremoniously
- Make the PE loader work for DLLs as well in case we ever want to load some - Make the PE loader work for DLLs as well in case we ever want to load some
---
Related projects:
* [taviso/loadlibrary](https://github.com/taviso/loadlibrary)

View File

@ -1,5 +1,6 @@
#include "common.h" #include "common.h"
#include <asm/ldt.h> #include <asm/ldt.h>
#include <filesystem>
#include <errno.h> #include <errno.h>
#include <memory> #include <memory>
#include <sys/mman.h> #include <sys/mman.h>
@ -176,7 +177,14 @@ int main(int argc, char **argv) {
wibo::Executable exec; wibo::Executable exec;
wibo::mainModule = &exec; wibo::mainModule = &exec;
FILE *f = fopen(argv[1], "rb"); char* pe_path = argv[1];
FILE *f = fopen(pe_path, "rb");
if (!f) {
std::string mesg = std::string("Failed to open file ") + pe_path;
perror(mesg.c_str());
return 1;
}
exec.loadPE(f); exec.loadPE(f);
fclose(f); fclose(f);

6
test/test.c Normal file
View File

@ -0,0 +1,6 @@
float apple = 3.0f;
float banana = 65.32f;
int something(void) {
return (int)(apple * banana) % 11;
}