Skip to content

Commit

Permalink
Merge pull request #10 from AKuHAK/patch-3
Browse files Browse the repository at this point in the history
Windows build and GitHub actions fixed
  • Loading branch information
fjtrujy authored Jan 30, 2021
2 parents 8236fba + e1af223 commit c0e2b3b
Show file tree
Hide file tree
Showing 14 changed files with 244 additions and 106 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig: http://EditorConfig.org

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

# 1 space indentation
[*.{c,h,js,css,html}]
indent_style = space
indent_size = 1

# Tab indentation
[Makefile*]
indent_style = tab
111 changes: 79 additions & 32 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,101 @@ name: CI
on:
push:
pull_request:
repository_dispatch:
types: [run_build]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]

steps:
steps:
- uses: actions/checkout@v2
- name: Runs all the stages in the shell

- name: Compile native versions
run: |
export PS2DEV=$PWD/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
export GSKIT=$PS2DEV/gsKit
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
make clean all install
make --debug
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"

- name: Compress bin folder
run: |
tar -zcvf bin.tar.gz ps2dev/bin

- name: Create tar archive (keep executable bit)
run: tar -zcvf ps2client-${{ steps.slug.outputs.sha8 }}-${{matrix.os}}.tar.gz bin

- uses: actions/upload-artifact@v2
with:
name: ps2client-${{ steps.slug.outputs.sha8 }}-${{matrix.os}}
path: ps2dev/bin/
path: |
*tar.gz
build-win:
runs-on: ubuntu-latest
container: dockcross/windows-static-x86:latest

- name: Extract tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag
uses: actions/[email protected]
steps:
- uses: actions/checkout@v2

- name: Compile windows version with cross-compilator
run: |
make -f Makefile.mingw32 --trace
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"

- name: Create tar archive
run: tar -zcvf ps2client-${{ steps.slug.outputs.sha8 }}-windows-latest.tar.gz bin

- uses: actions/upload-artifact@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
return context.payload.ref.replace(/\/refs\/tags\//, '');
name: ps2client-${{ steps.slug.outputs.sha8 }}-windows-latest
path: |
*tar.gz
release:
needs: [build, build-win]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2

- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"

- name: Download Mac artifact
uses: actions/download-artifact@v2
with:
name: ps2client-${{ steps.slug.outputs.sha8 }}-macos-latest

- name: Download Ubuntu artifact
uses: actions/download-artifact@v2
with:
name: ps2client-${{ steps.slug.outputs.sha8 }}-ubuntu-latest

- name: Download Windows artifact
uses: actions/download-artifact@v2
with:
name: ps2client-${{ steps.slug.outputs.sha8 }}-windows-latest

- name: Create pre-release
if: github.ref == 'refs/heads/master'
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
automatic_release_tag: "latest"
title: "Development build"
files: |
*tar.gz
- name: Create Tagged Release Draft
if: startsWith(github.ref, 'refs/tags/v')
uses: marvinpinto/action-automatic-releases@latest
with:
files: ps2dev.tar.gz
tag_name: ${{ steps.tag.outputs.result }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
draft: true
files: |
*tar.gz
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
else
LIBS = -lwsock32 -lpthreadGC2
endif

ifeq "x$(PREFIX)" "x"
PREFIX = $(PS2DEV)
endif
Expand Down
17 changes: 8 additions & 9 deletions Makefile.mingw32
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

GCC = i586-mingw32msvc-gcc -Wall
INC = -I ../pthreads-win32
LIB = -lwsock32 -lpthreadGC2 -L ../pthreads-win32
#CC = i686-w64-mingw32.static-gcc -Wall
LIB = -lwsock32 -lpthread

ifeq "x$(PREFIX)" "x"
PREFIX = $(PS2DEV)
Expand All @@ -19,31 +18,31 @@
OFILES += obj/network.o
obj/network.o: src/network.c src/network.h
@mkdir -p obj
$(GCC) $(INC) -c src/network.c -o obj/network.o
$(CC) $(INC) -c src/network.c -o obj/network.o

OFILES += obj/ps2link.o
obj/ps2link.o: src/ps2link.c src/ps2link.h
@mkdir -p obj
$(GCC) $(INC) -c src/ps2link.c -o obj/ps2link.o
$(CC) $(INC) -c src/ps2link.c -o obj/ps2link.o

OFILES += obj/ps2netfs.o
obj/ps2netfs.o: src/ps2netfs.c
@mkdir -p obj
$(GCC) $(INC) -c src/ps2netfs.c -o obj/ps2netfs.o
$(CC) $(INC) -c src/ps2netfs.c -o obj/ps2netfs.o

OFILES += obj/utility.o
obj/utility.o: src/utility.c src/utility.h
@mkdir -p obj
$(GCC) $(INC) -c src/utility.c -o obj/utility.o
$(CC) $(INC) -c src/utility.c -o obj/utility.o

#####################
## CLIENT PROGRAMS ##
#####################

bin/fsclient.exe: $(OFILES) src/fsclient.c
@mkdir -p bin
$(GCC) $(INC) $(OFILES) src/fsclient.c -o bin/fsclient.exe $(LIB)
$(CC) $(INC) $(OFILES) src/fsclient.c -o bin/fsclient.exe $(LIB)

bin/ps2client.exe: $(OFILES) src/ps2client.c
@mkdir -p bin
$(GCC) $(INC) $(OFILES) src/ps2client.c -o bin/ps2client.exe $(LIB)
$(CC) $(INC) $(OFILES) src/ps2client.c -o bin/ps2client.exe $(LIB)
104 changes: 103 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,105 @@
# PS2Client

![CI](https://github.com/ps2dev/ps2client/workflows/CI/badge.svg)
![CI](https://github.com/ps2dev/ps2client/workflows/CI/badge.svg)


## PS2CLIENT USAGE AND INFORMATION

### THE INTRODUCTION

These programs, ps2client & fsclient, are command line tools used for interacting with a ps2 system running ps2link and/or ps2netfs. It will allow you to send various commands as well as respond to requests for data. This program was written and tested under Linux, Cygwin and Mac OS X but should compile on any reasonably unixlike system.

### BUILDING THE CLIENTS
Building and installing is very simple:

`make clean; make install`

There are some build options, however:

`PREFIX=/dir`

Install directory, defaults to: `$PS2DEV`. `/bin` will be automatically appended.
The software will be installed to the `/bin` sub-directory, under `PREFIX` (`PREFIX/bin`).

These options can be used as follows:

`make clean; make PREFIX=/new/path/prefix install`

### BUILDING WINDOWS BINARIES
For building windows binaries on Unix system, you need to setup mingw cross-compiler and win32 threads.
Build command:

`make -f Makefile.mingw32`

### BASIC CLIENT USAGE
Basic usage:

```
ps2client [-h hostname] [-t timeout] <command> [arguments]
fsclient [-h hostname] <command> <arguments>
```

**[-h hostname]**

The address of the remote ps2. This can be an IP or a hostname. If none is given, the environment variable `$PS2HOSTNAME` will be checked for a valid address. If this variable isn't set, a default of 192.168.0.10 will be used.

**[-t timeout]**

An idle timeout period in seconds that the client will wait before exiting. This is useful to allow a script to continue after calling ps2client to send a command to ps2link or ps2netfs.

### PS2LINK COMMANDS
- `reset`

Send a reset request to ps2link.

- `execiop <filename> [arguments]`

Tell ps2link to load and execute a file on the IOP.

- `execee <filename> [arguments]`

Tell ps2link to load and execute a file on the EE.

- `poweroff`

Send a poweroff request to ps2link.

- `scrdump`

Tell ps2link to dump exceptions to the screen.

- `netdump`

Tell ps2link to dump execetions to the network console.

- `dumpmem <offset> <size> <filename>`

Dump the contents of memory into a file.

- `startvu <vu>`

Tell the specified vector unit to start operation.

- `stopvu <vu>`

Tell the specified vector unit to stop operation.

- `dumpreg <type> <filename>`

Dump the registers of a given type into a file.

- `gsexec <size> <filename>`

Tell ps2link to load and send a file to the GS.

- `writemem <offset> <size> <filename>`

Write the contents of a file into memory.

- `iopexcep`

I really don't know! OH NOES!!

- `listen`

Listen to the ps2link network console.
8 changes: 4 additions & 4 deletions doc/license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the author(s) may not be used to endorse or promote products
* 3. The name of the author(s) may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
Expand Down
2 changes: 1 addition & 1 deletion doc/ps2link-protocol.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
tell it what to do. These are simple commands sent as single packets for
executing programs, resetting ps2link or other things. This list may grow
as time goes on and new functionality is added to ps2link.

----------------------------
0xBABE0201 (reset command)
----------------------------
Expand Down
28 changes: 2 additions & 26 deletions doc/readme-mingw32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,5 @@
----------------------------------

Since now, ps2client uses the pthread library to work, you need the
pthreads-win32 native library to compile ps2client using a mingw32
compiler. You want to download the prebuilt binaries and headers
from ftp://sources.redhat.com/pub/pthreads-win32 and put them
in the ../pthreads-win32 directory. You need the following files:

libpthreadGC2.a
pthread.h
pthreadGC2.dll
sched.h
semaphore.h

Note that if you're using a linux host to cross compile, you probably
want to dos2unix *.h before compiling.

------------------
MORE INFORMATION
------------------

If you want to get into the wonderful world of homebrew ps2
development, there's a few places you can check out:

http://www.ps2dev.org - News, tutorials and documentation.

http://forums.ps2dev.org - The official ps2dev forums.

#ps2dev on efnet (IRC) - Come banter in realtime.
threads support. For example you can use MXE/MinGW-w64 with win32
threads.
Loading

0 comments on commit c0e2b3b

Please sign in to comment.