-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9013e6e
Showing
40 changed files
with
44,826 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Language: Cpp | ||
BasedOnStyle: Google | ||
TabWidth: 2 | ||
SpaceBeforeCpp11BracedList: true | ||
Cpp11BracedListStyle: false | ||
AlignAfterOpenBracket: DontAlign | ||
IncludeBlocks: Merge | ||
NamespaceIndentation: Inner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: CI | ||
on: | ||
- push | ||
env: | ||
SOLUTION_FILE_PATH: . | ||
BUILD_CONFIGURATION: Release | ||
CL: /source-charset:.949 /execution-charset:.949 | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: microsoft/setup-msbuild@v1 | ||
- working-directory: ${{env.GITHUB_WORKSPACE}} | ||
run: >- | ||
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} | ||
${{env.SOLUTION_FILE_PATH}} | ||
- run: echo "filename=${GITHUB_REPOSITORY#*/}-${GITHUB_REF##*/}.zip" >> $GITHUB_OUTPUT | ||
shell: bash | ||
id: zip | ||
- uses: vimtor/action-zip@v1.1 | ||
with: | ||
files: Release/ddraw.dll | ||
dest: ${{steps.zip.outputs.filename}} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: ${{steps.zip.outputs.filename}} | ||
outputs: | ||
filename: ${{steps.zip.outputs.filename}} | ||
release: | ||
needs: | ||
- build | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
- uses: tubone24/update_release@v1.3.1 | ||
id: update_release | ||
env: | ||
GITHUB_TOKEN: ${{github.token}} | ||
- uses: tanyagray/action-upload-release-asset@v1.1.3 | ||
env: | ||
GITHUB_TOKEN: ${{github.token}} | ||
with: | ||
upload_url: ${{steps.update_release.outputs.upload_url}} | ||
asset_path: artifact/${{needs.build.outputs.filename}} | ||
asset_name: ${{needs.build.outputs.filename}} | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
BSD 2-Clause License | ||
|
||
Copyright (c) 2023, Lee Jeonghun | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, 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 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause) | ||
[![CI](https://github.com/leejeonghun/san2kr/actions/workflows/main.yml/badge.svg)](https://github.com/leejeonghun/san2kr/actions/workflows/main.yml) | ||
# san2kr | ||
|
||
|
||
코에이테크모의 스팀판 [삼국지2](https://store.steampowered.com/app/521690/Romance_of_the_Three_Kingdoms_II/)의 한글 패치입니다. | ||
|
||
![screenshot](https://github.com/leejeonghun/san2kr/assets/11531985/f6341895-d19c-4843-93da-5101d80598cc) | ||
|
||
|
||
## 기능 | ||
|
||
* 본 패치 적용 시, 후리가나를 제외한 게임 내 전체 텍스트가 한글화 되며, 일본어가 포함된 경로 접근이 가능하도록 수정하여 세이브/로드가 정상적으로 동작합니다. | ||
* 번역된 텍스트는 [여기](https://github.com/leejeonghun/san2kr/tree/main/translate)의 JSON 파일 포맷으로 관리됩니다. | ||
* 텍스트 번역은 비스코에서 출시한 DOS용 한글판을 참고하였습니다. 참고하기 위해 추출한 텍스트 내역은 [여기](https://github.com/leejeonghun/san2kr/tree/main/reference)서 확인 가능합니다. | ||
|
||
|
||
## 사용법 | ||
|
||
ddraw.dll 파일을 게임 설치 폴더에 복사한 후 게임을 실행하면 게임 내 텍스트가 한글 번역되어 출력됩니다. | ||
해당 파일을 삭제하면 원복됩니다. | ||
|
||
개인적으로 만든 프로그램이라, 디지털 서명이 되어 있지 않습니다. 다운로드 및 압축 해제 시 웹브라우저 보안 경고 및 윈도우에서 스마트 스크린 경고가 뜰 수 있으므로 참고 부탁드립니다. | ||
|
||
|
||
## 라이선스 | ||
|
||
BSD 라이선스를 따릅니다. MIT 라이선스인 [JSON for Modern C++](https://github.com/nlohmann/json)을 사용합니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright 2023 jeonghun | ||
|
||
#ifndef SAN2KR_DDRAW_CODEPAGE_H_ | ||
#define SAN2KR_DDRAW_CODEPAGE_H_ | ||
|
||
#include <windows.h> | ||
#include <cstdint> | ||
|
||
template <int T = CP_UTF8> | ||
class codepage final { | ||
public: | ||
explicit codepage(const char* str) { | ||
int req_ch_cnt = MultiByteToWideChar(T, 0, str, -1, nullptr, 0); | ||
if (req_ch_cnt > _countof(src_buf_)) { | ||
unicode_ = new wchar_t[req_ch_cnt]; | ||
} | ||
MultiByteToWideChar(T, 0, str, -1, unicode_, req_ch_cnt); | ||
} | ||
|
||
~codepage() { | ||
if (unicode_ != src_buf_) delete[] unicode_; | ||
if (mbcs_ != dst_buf_) delete[] mbcs_; | ||
} | ||
|
||
inline operator const wchar_t*() const { return unicode_; } | ||
inline const char* to_cp949() { return conv_to(949); } | ||
inline const char* to_cp932() { return conv_to(932); } | ||
|
||
private: | ||
inline const char* conv_to(int codepage) { | ||
int req_size = WideCharToMultiByte( | ||
codepage, 0, unicode_, -1, nullptr, 0, nullptr, nullptr); | ||
if (req_size > sizeof(dst_buf_)) mbcs_ = new char[req_size]; | ||
|
||
WideCharToMultiByte( | ||
codepage, 0, unicode_, -1, mbcs_, req_size, nullptr, nullptr); | ||
return mbcs_; | ||
} | ||
|
||
wchar_t src_buf_[128]; | ||
char dst_buf_[sizeof(src_buf_)]; | ||
wchar_t* unicode_ = src_buf_; | ||
char* mbcs_ = dst_buf_; | ||
}; | ||
|
||
inline bool is_cp949(uint16_t mbch) { | ||
// 가~괆 B0A1~B0FE | ||
// 괌~깸 B1A1~B1FE | ||
// 깹~끙 B2A1~B2FE | ||
// 끝~뇝 B3A1~B3FE | ||
// 뇟~덥 B4A1~B4FE | ||
// 덧~딸 B5A1~B5FE | ||
// 땀~랗 B6A1~B6FE | ||
// 래~륩 B7A1~B7FE | ||
// 륫~뫼 B8A1~B8FE | ||
// 묀~벗 B9A1~B9FE | ||
// 벙~빤 BAA1~BAFE | ||
// 빨~샤 BBA1~BBFE | ||
// 샥~숭 BCA1~BCFE | ||
// 숯~쐰 BDA1~BDFE | ||
// 쐴~엎 BEA1~BEFE | ||
// 에~웨 BFA1~BFFE | ||
// 웩~젊 C0A1~C0FE | ||
// 점~짓 C1A1~C1FE | ||
// 징~찻 C2A1~C2FE | ||
// 찼~층 C4A1~C4FE | ||
// 치~퉜 C5A1~C5FE | ||
// 퉤~퐁 C6A1~C6FE | ||
// 퐈~혠 C7A1~C7FE | ||
// 혤~힝 C8A1~C8FE | ||
const uint8_t lo = HIBYTE(mbch); | ||
const uint8_t hi = LOBYTE(mbch); | ||
return (0xB0 <= hi && hi <= 0xC8) && (0xA1 <= lo && lo <= 0xFE); | ||
} | ||
|
||
inline bool exist_cp949(const char* str) { | ||
while (*str != '\0') { | ||
if (static_cast<unsigned char>(*str) > 0x7F) { | ||
auto mbch = *reinterpret_cast<const uint16_t*>(str); | ||
str += 2; | ||
if (is_cp949(mbch)) return true; | ||
} else { | ||
str++; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
#endif // SAN2KR_DDRAW_CODEPAGE_H_ |
Oops, something went wrong.