-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from great-majority/feat/honeycome
Feat/honeycome
- Loading branch information
Showing
9 changed files
with
185 additions
and
11 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,96 @@ | ||
import io | ||
import struct | ||
|
||
import kkloader.KoikatuCharaData | ||
from kkloader.funcs import load_length, msg_pack, msg_unpack | ||
from kkloader.KoikatuCharaData import BlockData | ||
|
||
|
||
class HoneycomeCharaData(kkloader.KoikatuCharaData): | ||
def __init__(self): | ||
self.modules = { | ||
"Custom": Custom, | ||
"Coordinate": Coordinate, | ||
"Parameter": kkloader.kk_Parameter, | ||
"Status": kkloader.kk_Status, | ||
"Graphic": Graphic, | ||
"About": kkloader.kk_About, | ||
"GameParameter_HCP": GameParameter_HCP, | ||
"GameInfo_HCP": GameInfo_HCP, | ||
} | ||
|
||
|
||
class Custom(BlockData): | ||
fields = ["face", "body"] | ||
|
||
def __init__(self, data, version): | ||
self.name = "Custom" | ||
self.version = version | ||
self.data = {} | ||
data_stream = io.BytesIO(data) | ||
for f in self.fields: | ||
self.data[f] = msg_unpack(load_length(data_stream, "i")) | ||
|
||
def serialize(self): | ||
data = [] | ||
pack = struct.Struct("i") | ||
for f in self.fields: | ||
field_s, length = msg_pack(self.data[f]) | ||
data.append(pack.pack(length)) | ||
data.append(field_s) | ||
serialized = b"".join(data) | ||
return serialized, self.name, self.version | ||
|
||
|
||
class Coordinate(BlockData): | ||
fields = [ | ||
"clothes", | ||
"accessory", | ||
"makeup", | ||
"hair", | ||
"nail", | ||
] | ||
|
||
def __init__(self, data, version): | ||
self.name = "Coordinate" | ||
self.version = version | ||
if data is None: | ||
return | ||
|
||
self.data = [] | ||
for coordinate_bytes in msg_unpack(data): | ||
data_stream = io.BytesIO(coordinate_bytes) | ||
coordinate_dict = {} | ||
for f in self.fields: | ||
coordinate_dict[f] = msg_unpack(load_length(data_stream, "i")) | ||
self.data.append(coordinate_dict) | ||
|
||
def serialize(self): | ||
data = [] | ||
for i in self.data: | ||
c = [] | ||
pack = struct.Struct("i") | ||
|
||
for f in self.fields: | ||
serialized, length = msg_pack(i[f]) | ||
c.extend([pack.pack(length), serialized]) | ||
|
||
data.append(b"".join(c)) | ||
serialized_all, _ = msg_pack(data) | ||
|
||
return serialized_all, self.name, self.version | ||
|
||
|
||
class Graphic(BlockData): | ||
def __init__(self, data, version): | ||
super().__init__(name="Graphic", data=data, version=version) | ||
|
||
|
||
class GameParameter_HCP(BlockData): | ||
def __init__(self, data, version): | ||
super().__init__(name="GameParameter_HCP", data=data, version=version) | ||
|
||
|
||
class GameInfo_HCP(BlockData): | ||
def __init__(self, data, version): | ||
super().__init__(name="GameInfo_HCP", data=data, version=version) |
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
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
from .KoikatuCharaData import * # noqa isort: skip | ||
from .KoikatuCharaData import ( # noqa isort: skip | ||
Custom as kk_Custom, | ||
Coordinate as kk_Coordinate, | ||
Parameter as kk_Parameter, | ||
About as kk_About, | ||
Status as kk_Status, | ||
KKEx as kk_KKEx, | ||
KoikatuCharaData, | ||
) | ||
from .KoikatuSaveData import KoikatuSaveData # noqa isort: skip | ||
from .EmocreCharaData import EmocreCharaData # noqa | ||
from .EmocreMapData import EmocreMapData # noqa | ||
from .EmocreSceneData import EmocreSceneData # noqa | ||
from .HoneycomeCharaData import HoneycomeCharaData # noqa |
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
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