Skip to content

Commit

Permalink
Updated source control rules
Browse files Browse the repository at this point in the history
Added clang-format lint action
Updated makefiles
Added make format
  • Loading branch information
AKuHAK committed Jun 24, 2021
1 parent d944b2c commit ee0b816
Show file tree
Hide file tree
Showing 34 changed files with 512 additions and 448 deletions.
71 changes: 54 additions & 17 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,70 @@ Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: AcrossEmptyLinesAndComments
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignConsecutiveMacros: AcrossComments
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing : Both
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: true
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ (IWYU pragma:|NOLINT)'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
FixNamespaceComments: true
ForEachMacros: []
IncludeBlocks: Preserve
IndentExternBlock: NoIndent
IndentCaseBlocks: false
IndentCaseLabels: true
IndentGotoLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
Expand All @@ -55,21 +77,36 @@ NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 80
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 80
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 80
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
# uncomment below when clang >13 will be out
# IndentPPDirectives: AfterHash
# PPIndentWidth: 1
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeInheritanceColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
Expand Down
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
16 changes: 16 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Run clang-format Linter

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: '.'
extensions: 'h,cpp,c'
clangFormatVersion: 12
inplace: False
39 changes: 19 additions & 20 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,36 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:

steps:
- uses: actions/checkout@v2

- name: Install Ubuntu version
if: ${{ matrix.os == 'ubuntu-latest' && always() }}
run: |
make --trace RELEASE=yes
run: make --trace RELEASE=yes

- name: Install Mac version
if: ${{ matrix.os == 'macos-latest' && always() }}
run: |
make --debug USE_THREADED_IIN=no IIN_OPTICAL_MMAP=no RELEASE=yes
run: make --debug USE_THREADED_IIN=no IIN_OPTICAL_MMAP=no RELEASE=yes

- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"

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

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

steps:
- uses: actions/checkout@v2

- name: Compile windows version with cross-compilator
Expand All @@ -50,32 +49,32 @@ jobs:
mv hdl_dump.exe rel/
make clean
make --trace -C gui XC=win RELEASE=yes
mv gui/hdl_dumb.exe rel/
mv gui/hdl_dumb.exe rel/
- 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 hdl-dump-${{ steps.slug.outputs.sha8 }}-windows-latest.tar.gz rel

- uses: actions/upload-artifact@v2
with:
name: hdl-dump-${{ 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: 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:
Expand All @@ -101,7 +100,7 @@ jobs:
title: "Development build"
files: |
*tar.gz
- name: Create Tagged Release Draft
if: startsWith(github.ref, 'refs/tags/v')
uses: marvinpinto/action-automatic-releases@latest
Expand All @@ -110,4 +109,4 @@ jobs:
prerelease: false
draft: true
files: |
*tar.gz
*tar.gz
33 changes: 0 additions & 33 deletions .github/workflows/ps2_compile.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#
# NOTE! Please use 'git ls-files -i --exclude-standard -c'
# command after changing this file, to see if there are
# any tracked files which get ignored after the change.
#
# Normal rules
*.d
.*
*.o
*.exe
*_irx.c
*.elf
open-ps2-loader
hdl_dump

#
# files that we don't want to ignore
#
!.gitignore
!.gitattributes
!.github
!.editorconfig
!.clang-format
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ lint2:
-weak -bufferoverflowhigh +longintegral +ignoresigns -ifempty \
-varuse -initallelements $(SOURCES:osal_unix.c=)

format:
find . -type f -a \( -iname \*.h -o -iname \*.c \) | xargs clang-format -i

format-check:
@! find . -type f -a \( -iname \*.h -o -iname \*.c \) | xargs clang-format -style=file -output-replacements-xml | grep "<replacement "

# rules below
rsrc.o: rsrc.rc
Expand All @@ -194,7 +199,7 @@ $(BINARY): $(OBJECTS)
@echo -e "\tDEP $<"
@$(CC) -MM $(CFLAGS) $< > $@


ifneq ($(MAKECMDGOAL),rmdeps)
GOALS := rmdeps format clean format-check lint lint2
ifeq (,$(filter $(GOALS),$(MAKECMDGOALS)))
-include $(DEPENDS)
endif
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ Easy guide for installing games can be found here <http://web.archive.org/web/20

## Networking server

A UDP-based network server is available, based on the SMAP driver recently released on psx-scene forums <http://ichiba.geocities.jp/ysai187/PS2/smap.htm>. It is called `hdl_svr_093.elf` and is now part of the `hdl_dump` sources.
*Update:* Currently, opl built-in server is the preffered option.

*Deprecated:*
A UDP-based network server is available, based on the SMAP driver released by @sp193 <http://ichiba.geocities.jp/ysai187/PS2/smap.htm>. It is called `hdl_svr_093.elf` and is now part of the `hdl_dump` sources.

_**Note**: You might need to punch a hole in your firewall for incoming UDP from port 12345._

Expand Down Expand Up @@ -58,8 +61,8 @@ Finally: You just can run shell script in the project folder: `mkrel.sh`. It wil
You can place this files in folder where is installed hdl_dump for making it portable.

* **Windows**: (cited names are for English version of Windows)
`C:\Documents and Settings\<login name>\Application Data\hdl_dump.conf`
`C:\Documents and Settings\<login name>\Application Data\hdl_dump.list`
`%APPDATA%\hdl_dump.conf`
`%APPDATA%\hdl_dump.list`

* **Linux**, **Mac OS X** and **FreeBSD**: (`~` is your home dir)
`~/.hdl_dump.conf`
Expand Down Expand Up @@ -108,8 +111,6 @@ All HDD data will remain intact.

`MBR.KELF` size should be maximum 883200 bytes and have valid header.

There is no easy way to make `MBR.KELF`s from a common elf.

_**Note**: In a previous version this command tried to install one `__mbr` partition, but this command didn't work correctly and was replaced with MBR injection._


Expand Down Expand Up @@ -152,8 +153,8 @@ Now `icon.sys` can be in any of 2 formats: Memory Card format or HDD format.

### Hiding Games

You can hide games so that they are not visible in the HDD Browser by using the -hide switch with the 'install', 'inject_cd',
'inject_dvd' or 'modify' commands. A hidden game can be made visible again using the -unhide switch with the 'modify' command.
You can hide games so that they are not visible in the HDD Browser by using the `-hide` switch with the `install`, `inject_cd`,
`inject_dvd` or `modify` commands. A hidden game can be made visible again using the `-unhide` switch with the `modify` command.


### Others
Expand All @@ -171,6 +172,8 @@ There are also some undocumented features like this:
This is used for HDL games for example.
If you need to erase `boot.elf` from PATINFO you have to place zero-sized `boot.kelf` or elf in program folder.

_**Note**: PSX1 (DESR 1st generation) doesnt support PATINFO paramater. Only next option is available._

* If you want to launch KELF from PFS partition you have to change `BOOT2` in `system.cnf`

```
Expand Down
Loading

0 comments on commit ee0b816

Please sign in to comment.