Skip to content

Commit

Permalink
Merge pull request #3 from miu200521358/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
miu200521358 authored Jul 12, 2024
2 parents 95a90f1 + 60dea8f commit ef55dab
Show file tree
Hide file tree
Showing 765 changed files with 253,760 additions and 103 deletions.
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,12 @@
# Go workspace file
go.work

build

build/
distribution/

cmd/user_config.json
*.vmd
*.pmx
*.pprof
*.log
cmd/framebuffer_output.png
36 changes: 36 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/cmd/main.go",
"preLaunchTask": "go: mod tidy",
},
{
"name": "[dev] Build",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/.vscode/scripts/build_exe.py",
"env": {
"WORKSPACE_FOLDER": "${workspaceFolder}",
"ENV": "dev"
},
},
{
"name": "[prod] Build",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/.vscode/scripts/build_exe.py",
"env": {
"WORKSPACE_FOLDER": "${workspaceFolder}",
"ENV": "prod"
},
}
]
}
45 changes: 45 additions & 0 deletions .vscode/scripts/build_exe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import json
import os
import winsound
# 環境変数 WORKSPACE_FOLDER の値を取得
workspace_folder = os.environ.get('WORKSPACE_FOLDER')

# 値を表示
print(f"workspace_folder: {workspace_folder}")

# Read app_config.json file
with open(f'{workspace_folder}/cmd/app/app_config.json', 'r', encoding='utf-8') as file:
config_data = json.load(file)

# Convert JSON data to dictionary
config_dict = dict(config_data)

app_name = config_dict.get('Name')
app_version = config_dict.get('Version')

print(f"app_name: {app_name}")
print(f"app_version: {app_version}")

all_rebuild = "" if os.environ.get('ENV') == 'dev' else "-a"
env_name = "dev" if os.environ.get('ENV') == 'dev' else "prod"

# Build command
# -o 出力フォルダ
# -trimpath ビルドパスを削除
# -v ビルドログを出力
# -a 全ての依存関係を再ビルド
# -buildmode=exe 実行可能ファイルを生成
# -ldflags "-s -w" バイナリサイズを小さくする
# -H=windowsgui コンソールを表示しない
# -linkmode external -extldflags '-static -Wl,cmd/app/app.res' リソースを埋め込む
build_command = f"go build -o {workspace_folder}/build/{app_name}_{app_version}.exe -trimpath " \
f"-v {all_rebuild} -buildmode=exe -ldflags \"-s -w -H=windowsgui -X main.env={env_name} " \
f"-linkmode external -extldflags '-static -Wl,{workspace_folder}/cmd/app/app.res'\" " \
f" {workspace_folder}/cmd/main.go"

print(f"build_command: {build_command}")

os.system(build_command)

# Play beep sound
winsound.PlaySound("SystemAsterisk", winsound.SND_ALIAS)
3 changes: 3 additions & 0 deletions .vscode/scripts/clear.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go clean --modcache
go clean -cache
go clean -testcache
8 changes: 8 additions & 0 deletions .vscode/scripts/delete_pre_debug_exe.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo off

echo workspaceFolder: %workspaceFolder%

call del %workspaceFolder%\cmd\__debug_bin*
call del %workspaceFolder%\go\cmd\__debug_bin*

exit 0
51 changes: 51 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "shell: delete pre debug exe",
"type": "shell",
"command": "cmd.exe",
"args": [
"/c",
"set \"workspaceFolder=${workspaceFolder}\" && C:/MMD/mlib_go/.vscode/scripts/delete_pre_debug_exe.bat"
],
"group": {
"kind": "none",
"isDefault": true
},
"presentation": {
"echo": false,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
}
},
{
"label": "go: mod tidy",
"type": "shell",
"command": "go",
"args": [
"mod",
"tidy"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": false,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"dependsOn": [
"shell: delete pre debug exe"
],
"problemMatcher": []
}
]
}
134 changes: 133 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,140 @@
# mlib_go

# 新規作成
## 新規作成

```
(mtool) C:\MMD\mlib_go\backend>go mod init github.com/miu200521358/mlib_go
go: creating new go.mod: module github.com/miu200521358/mlib_go
```

## Clone Build

- VSCode に go 拡張をいれる `golang.go`
- コマンドプロンプトで下記を実行(× Power Shell)
- https://jmeubank.github.io/tdm-gcc/download/ をインストール
- `Minimal online installer. ` (多分最初のexeボタン)
- PATH に TDM-GCC-64 までのパスを追加
- go.mod の最後の3行(replaceのとこ)をコメントアウト
- 開発用にローカルのを参照しているため
- ライブラリインポート
- `set GOOS=windows`
- `set GOARCH=amd64`
- `set CGO_ENABLED=1`
- `go mod tidy`
- ビルドできるはず
- `set CGO_ENABLED=1`
- `go run main.go`
- `go build -o ../build/mlib.exe main.go`
- ビルドできたらVSCode再起動で run もできるようになってるはず

## キャッシュクリア系

```
go clean --modcache
go clean -cache
go clean -testcache
```

## フォーマット

```
go fmt ./...
```

## アイコンの組み込み

1. .icoファイルを作成
2. .rcファイルを作成
- `IDI_ICON1 ICON DISCARDABLE "app.ico"`
3. .resファイルにコンパイル
- `windres -O coff -o app.res app.rc`
4. ビルドスクリプトで実行


## プロファイル

1. `go run crumb/profile.go`
2. `go tool pprof crumb\profile.go crumb\cpu.pprof`
- `go tool pprof -flat crumb\profile.go crumb\cpu.pprof`
- `go tool pprof -cum crumb\profile.go crumb\cpu.pprof`
- `go tool pprof -http=:8080 cpu.pprof`
3. `(pprof) top`
4. プロファイル: ISAOミク+Addiction


### プロファイルのビジュアライザ

1. `go get github.com/goccy/go-graphviz/cmd/dot`
2. `go install github.com/goccy/go-graphviz`
4. `go tool pprof -http=:8081 mem.pprof`


## bullet

1. swig インストール
https://rinatz.github.io/swigdoc/abstract.html

2. 変換コード作成

```
(mtool) C:\MMD\mlib_go\pkg\mbt>swig -c++ -go -cgo -I"C:\MMD\mlib_go\pkg\mbt\bullet\src" -I"C:\development\TDM-GCC-64\lib\gcc\x86_64-w64-mingw32\10.3.0\include\c++\x86_64-w64-mingw32" -I"C:\development\TDM-GCC-64\x86_64-w64-mingw32\include" -I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include" -cpperraswarn -o "C:\MMD\mlib_go\pkg\mbt\mbt.cxx" "C:\MMD\mlib_go\pkg\mbt\bullet.i"
```

---------


## fyne (没)

```
go get fyne.io/fyne/v2@latest
go install fyne.io/fyne/v2/cmd/fyne@latest
```

```
C:\MMD\mlib_go>fyne bundle resources\MPLUS1-Regular.ttf > pkg\front\core\bundle.go
go get fyne.io/fyne/v2/internal/svg@v2.4.3
go get fyne.io/fyne/v2/storage/repository@v2.4.3
```

```
go get fyne.io/fyne/v2/internal/driver/glfw@v2.4.3
go get fyne.io/fyne/v2/app@v2.4.3
go get fyne.io/fyne/v2/widget@v2.4.3
go get fyne.io/fyne/v2/internal/painter@v2.4.3
```

```
fyne bundle icon.png > icon.go
```

```
go get fyne.io/fyne/v2
go get github.com/ungerik/go3d
go get github.com/fyne-io/glfw-js
go get fyne.io/fyne/v2/layout
```

### walk

```
go get github.com/akavel/rsrc
cd %GOPATH%\pkg\mod\github.com\akavel\rsrc@v0.10.2
go build
```

```
rsrc -manifest main.manifest -o rsrc.syso
```

```
go get -u golang.org/x/image
```


### GCプロファイル

1. `set GOGC=1000`
2. `set GODEBUG=gctrace=1`
3. `(mtool) C:\MMD\mlib_go\crumb>go run profile.go`
4. `go tool pprof profile.go cpu.pprof`
5. `go tool pprof -http=:8080 cpu.pprof`
45 changes: 45 additions & 0 deletions archive/defender報告.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
https://www.microsoft.com/en-us/wdsi/submissionhistory


-------------------------


このソフトウェアは私が開発したもので、マルウェアに関するコードは組み込んでません。
Githubでコードを公開しています。

本体
https://github.com/miu200521358/vmd_sizing_t3/tree/develop
https://github.com/miu200521358/sword_blur/tree/develop

依存ライブラリ
https://github.com/miu200521358/mlib_go/tree/develop

ご査収の程よろしくお願いいたします。


----------------------

This software was developed by me, and it does not contain any malware-related code.

The code is publicly available on GitHub.

Main repository
https://github.com/miu200521358/vmd_sizing_t3/tree/develop

Dependencies library
https://github.com/miu200521358/mlib_go/tree/develop

Thank you for your consideration.


-------------------------

申し訳ありません。
先日このソフトウェアを「マルウェアである」と報告しましたが、正しくは「マルウェアと誤検知される」ため、再審査をして頂きたかったソフトウェアになります。


I'm sorry.

Recently, I reported this software as "malware," but it is actually "misidentified as malware." I would like to request a re-examination of this software.


Loading

0 comments on commit ef55dab

Please sign in to comment.