Commit Graph

100 Commits

Author SHA1 Message Date
salix5 bdd3995e38 Improve error message handling in DataManager (#2839) 2025-06-12 19:11:39 +08:00
Mercury233 9350f5d693 add myfopen, fix setlocale (#2713) 2025-04-21 10:08:00 +08:00
salix5 b2a50ac0a9 fix namespace irr::io 2025-03-14 19:10:07 +08:00
salix5 6c53d02a2b use <cstdlib> functions (#2720)
* replace exit

* replace malloc, calloc

* replace strtol

* #include <cstdlib>
2025-03-13 17:26:44 +08:00
salix5 559c72772c read bit field with sqlite3_column_int64 (#2704)
* read bit field with sqlite3_column_int64

follow the standard conversion

* handle all error code in v2

* always finalize stmt in ReadDB

* fix loop condition
2025-03-08 15:25:08 +08:00
salix5 adaf970bea fix DataManager::ReadScriptFromFile (#2714) 2025-03-03 11:23:59 +08:00
Mercury233 6bcc96d222 rename myfopen to mywfopen (#2691)
* use fopen in DataManager::ReadScriptFromFile

* rename myfopen to mywfopen

* use std namespace

---------

Co-authored-by: salix5 <salix5566@gmail.com>
2025-02-22 10:54:31 +08:00
salix5 3623387266 clean header 2025-02-22 10:37:38 +08:00
salix5 c675547122 replace snprintf, sscanf 2025-02-22 10:37:38 +08:00
salix5 f5955f854f replace fopen, fclose, fgets 2025-02-22 10:37:38 +08:00
Mercury233 122b4187cb fix ScriptReader (#2654) 2025-01-26 19:41:22 +08:00
salix5 d376ed0e65 use <cwchar> function (#2651) 2025-01-17 19:50:59 +08:00
salix5 b57b331b65 move struct CardDataC, deck sort functions to data_manager.h (#2647)
* move struct CardDataC to data_manager.h

* update struct CardDataC

* move deck sort functions to DataManager

* update DeckBuilder::filter_effect
2025-01-14 13:25:16 +08:00
salix5 578afd6bea return unknown_string in DataManager::GetSetName (#2650) 2025-01-14 11:21:10 +08:00
salix5 bb6ef1e1e6 static member DataManager::FileSystem (#2644) 2025-01-11 20:32:03 +08:00
salix5 aaa1d3cf9d fix ScriptReader (#2642)
* fix ScriptReader

* increase scriptBuffer

* fix DeckManager::LoadCurrentDeck
2025-01-04 19:34:48 +08:00
salix5 67c1269966 fix DataManager::ScriptReaderEx 2024-12-24 09:10:23 +08:00
salix5 a29eeabad3 update expansions priority (#2638) 2024-12-21 21:44:25 +08:00
salix5 fe53acb786 DataManager: add DefaultScriptReader (#2624)
* DataManager: add DefaultScriptReader

* update priority
2024-12-19 02:40:02 +08:00
salix5 49aa79afa8 update DataManager (#2629) 2024-12-07 18:57:46 +08:00
salix5 85793b7105 replace intN macro (#2627)
* remove int32

* replace uint32_t

* remove uint8
2024-12-05 19:29:41 +08:00
salix5 7721bfe017 remove NULL (#2626) 2024-12-04 23:19:51 +08:00
salix5 c1cd59c475 change byte to unsigned char (#2622)
the dependency of byte is Windows SDK, not common.h
2024-11-30 15:27:20 +08:00
salix5 b7541e8248 DataManage: fix LoadStrings(IReadFile* reader) (#2619) 2024-11-21 18:05:23 +08:00
salix5 ca30449956 use nullptr in script reader (#2612) 2024-11-13 21:35:46 +08:00
salix5 48b01b838c remove wcscpy, wcscat (#2602)
* use wcsncpy

* fix FileSystem::TraversalDir

* avoid wcscat

* remove wcscat

* add BufferIO::CopyWideString

* struct Config: path string changed to wchar_t[256]

* Revert "use wcsncpy"

This reverts commit b05e0c96a3.

* check lastcategory, lastdeck

* fix Game::LoadConfig

max length of filename should be determined by file system

* remove wcscpy

* use BufferIO::CopyWideString

* fix UpdateDeck

* myfilesystem: use std functions

* DataManager: fix GetNumString (#2603)

* DataManager: fix FormatAttribute, FormatRace

* update FormatAttribute, FormatRace

* DataManager: fix FormatType

* update FormatType

* DataManager: fix FormatSetName

* DataManager: fix FormatLinkMarker

* merge

* DataManager: fix GetNumString

* rebuild class ustring16 from edopro version

* add stringw conversion

core::stringw in current version does not have data()

* add CGUITTFont::drawUstring

* use drawUstring

* update DrawShadowText

* fix Game::lpcstring

* fix DuelInfo::vic_string

* add PACK_MAX_SIZE

* add IsExtension (#2604)

* CGUITTFont: use override

* ustring16: only accept basic_string
2024-11-06 08:34:12 +08:00
salix5 132e5277e7 update include files in DataManager (#2608)
* update include files in DataManager

* update DataManager::Error

* increase bucket count
2024-10-18 19:41:13 +08:00
salix5 b0e0ca3c79 add datas_begin(), strings_begin() (#2607)
* reorder

* DataManager: add datas_begin(), strings_begin()

* replace
2024-10-16 18:51:22 +08:00
salix5 cf135ac0cc DataManager: add ReadDB (#2600) 2024-10-16 16:52:33 +08:00
salix5 6a2deaac92 fix DataManager::FormatLocation (#2594) 2024-10-03 21:09:13 +08:00
salix5 a08631db2f class DataManager: use const member function (#2592)
* update DataManager::GetData()

* class DataManager: use const member function
2024-10-03 18:04:02 +08:00
salix5 080d7781f0 clean config.h (#2568)
* move header files to game.h

* include mutex when necessary

* include myfilesystem.h when necessary

* include thread when necessary

* include string

* include GL when necessary

* remove #pragma once

* rename guard macro to YGOPRO_CONFIG_H

* fix warning C4456, C4458

* move GL to game.h

* use <cstring> functions

* include <wchar.h>
2024-08-11 05:05:20 +08:00
salix5 e209e77502 disconnect when the packet is too large (#2551)
* use memcpy in DuelClient, NetServer

* NetServer: discard too large packet

* DuelClient: discard too large packet

* replace memcpy with std::memcpy

* disconnect when the packet is too large

* check packet_len

* check len in HandleCTOSPacket()

* check len in HandleSTOCPacketLan()

* remove bool type in HostInfo

* check len in packet handling

* add boundary check to STOC_CHAT packet

* use memcpy in DuelMode::JoinGame

* add DECK_MAX_SIZE, DECK_MIN_SIZE

* fix DuelMode::UpdateDeck()

* fix

* fix Manager::OpenDeckFile()

* update DuelMode init

* update DuelMode::JoinGame

* update DuelMode::GetResponse

* Revert "check len in packet handling"

This reverts commit 2b5c12f360.

* use memcpy in GetPosition

* check struct size by static_assert

* update DuelMode::UpdateDeck

* check if the struct is trivially copyable

* replace unsigned short to uint16_t

* replace unsigned int to uint32_t

* add padding member to STOC_HS_PlayerEnter

* workaround: use STOC_HS_PlayerEnter_size
2024-05-31 21:52:06 +08:00
Mercury233 1b59f4c602 support search part of setname (#2546) 2024-05-21 15:48:05 +08:00
salix5 4c91f19f41 fix EncodeUTF8, DecodeUTF8 (#2540)
* check sizeof(wchar_t)

* EncodeUTF8: use unsigned operand

* DecodeUTF8: use unsigned operand

* EncodeUTF8: check array size

* DecodeUTF8: check array size

* replace sprintf with snprintf

* zero initialize

* remove outdated macro

* remove outdated macro in clzma
2024-05-21 15:32:29 +08:00
salix5 7de2a00db6 check return value of sscanf() (#2532)
* check return value of sscanf()

* enable_log: default value 0x3

* replace atoi() with strtol()

* update LoadLFListSingle()

* set enable_log to unsigned bit field
2024-05-07 03:50:21 +08:00
salix5 497b364a2a add constant MAX_STRING_ID, MIN_CARD_ID (#2538)
MAX_STRING_ID=2047, MIN_CARD_ID=128
2024-04-28 21:39:11 +08:00
salix5 efb11b266f DataManager: get string functions unsigned int (#2527) 2024-04-24 14:47:10 +08:00
salix5 5532faadd2 update DataManager::LoadDB() (#2515) 2024-02-14 19:26:30 +08:00
salix5 05da015f89 Use array to store setcode (#2510)
* card_data.setcode: use std vector

* remove CARD_ARTWORK_VERSIONS_OFFSET

* add extra_setcode for cards with 5+ setcodes

* setcode use array

* Update data_manager.cpp
2024-02-12 16:38:50 +08:00
salix5 43fb962ba3 DataManager: GetData() use reference 2024-01-11 12:26:04 +08:00
salix5 2df783922a DataManager: update GetCodePointer() 2024-01-11 03:06:04 +08:00
salix5 c52977150a DataManager: change _strings to private 2024-01-10 17:45:54 +08:00
salix5 4297cb3ef6 DataManager: change _datas to private 2024-01-10 16:42:07 +08:00
salix5 7d446e2477 update card reader 2023-12-18 00:44:53 +08:00
Mercury233 27e06722c5 add RACE_ILLUSION, RACES_COUNT (#2494) 2023-05-03 14:36:42 +08:00
mercury233 8ac177c68f minor change declare order 2022-09-23 08:48:14 +08:00
Mercury233 fed41b69c3 update showing pack lists (#2434) 2022-09-22 10:45:51 +08:00
Mercury233 38e3690af7 fix & update loading database (#2410) 2021-12-30 11:58:24 +08:00
salix5 1e980497c8 update DataManager::GetDesc()
max id: 28bits
2021-10-03 21:36:14 +08:00