Skip to content

Commit fdfcf00

Browse files
committed
Merge branch 'release/2.x' into dev/v3
2 parents e15034e + 094b45b commit fdfcf00

File tree

51 files changed

+362
-1641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+362
-1641
lines changed

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
# axmol-2.8.1 ?? 2025
2+
3+
## Bug Fixes
4+
5+
- **Fix a regression introduced by 2.8.0 that improper Content-Length setting in HTTP requests, see #2686** by @halx99
6+
- Fix compile error when using AX_CORE_PROFILE option by @martinking71 in [#2677](https://github.com/axmolengine/axmol/pull/2677)
7+
- Fix lua-tests PhysicsTest not work by @halx99
8+
- Fix missing processor endif in platform/mac/GL-mac.h by @halx99
9+
- Fix package name for lua-tests, live2d-tests by @halx99
10+
- Fix AccelerometerTest of lua-tests not work by @halx99
11+
- Fix wasm downloader by @AlexandreK38 in [#2676](https://github.com/axmolengine/axmol/pull/2676)
12+
13+
## Deprecated
14+
15+
- Mark Director::setGLDefaultValues as deprecated; use setRenderDefaults instead by @halx99
16+
- Mark messageBox as deprecated; use showAlert instead by @halx99
17+
18+
## Improvements
19+
20+
- **Revert DrawNode color param to Color4F to fix Lua test issues** by @halx99
21+
- Add API ax::showAlert by @halx99
22+
- Add API HttpResponse::getStatusText by @halx99
23+
- Remove entries for non-existent Lua test cases by @halx99
24+
- Fix incorrect fmt::format format string by @halx99
25+
- Remove "CC" from the menu entries (cpp-/lua-tests) by @aismann in [#2688](https://github.com/axmolengine/axmol/pull/2688)
26+
- Remove unnecessary Lua files: LayerEx.lua, DrawPrimitives.lua.lua by @halx99
27+
- Use lua length operator `#` instead `table.getn` in CocoStudio.lua by @halx99
28+
- Update url of CurlTeset by @halx99
29+
- Ensure lua-tests RenderTextureTest case work as expected by @halx99
30+
- Add API PointArray::clear() by @aismann in [#2692](https://github.com/axmolengine/axmol/pull/2692)
31+
32+
## Notes
33+
34+
- **Revert DrawNode color parameter type**
35+
36+
**Reason**:
37+
In axmol-2.2.0, the `DrawNode` color parameter was changed from `Color4F` to `Color4B`. This change prevented certain Lua binding test cases from detecting color updates correctly.
38+
39+
**Impact**:
40+
As a result, some Lua tests failed to produce the expected rendering behavior, leading to inconsistent test outcomes.
41+
42+
**Solution**:
43+
The color parameter has been reverted to `Color4F`. Since `DrawNode` internally already uses `Color4F` to pass color data to the GPU, this change restores expected Lua test behavior without any noticeable performance loss.
44+
45+
146
# axmol-2.8.0 Sep.1 2025
247

348
## Bug fixes

axmol/2d/ActionCatmullRom.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ void PointArray::removeControlPointAtIndex(ssize_t index)
123123
_controlPoints.erase(iter);
124124
}
125125

126+
void PointArray::clear()
127+
{
128+
_controlPoints.clear();
129+
}
130+
126131
ssize_t PointArray::count() const
127132
{
128133
return _controlPoints.size();

axmol/2d/ActionCatmullRom.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ class AX_DLL PointArray : public Object, public Clonable
112112
*/
113113
void removeControlPointAtIndex(ssize_t index);
114114

115+
/** Remove all control points.
116+
*
117+
*/
118+
void clear();
119+
115120
/** Returns the number of objects of the control point array.
116121
*
117122
* @return The number of objects of the control point array.

axmol/2d/FontFNT.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ BMFontConfiguration::~BMFontConfiguration()
127127

128128
std::string BMFontConfiguration::description() const
129129
{
130-
return fmt::format("<BMFontConfiguration = " AX_FORMAT_PRINTF_SIZE_T " | Glphys:{} Kernings:{} | Image = {}>",
131-
(size_t)this, static_cast<int>(_fontDefDictionary.size()),
132-
static_cast<int>(_kerningDictionary.size()), _atlasName);
130+
return fmt::format("<BMFontConfiguration = {} | Glphys:{} Kernings:{} | Image = {}>", fmt::ptr(this),
131+
static_cast<int>(_fontDefDictionary.size()), static_cast<int>(_kerningDictionary.size()),
132+
_atlasName);
133133
}
134134

135135
void BMFontConfiguration::purgeKerningDictionary()

axmol/audio/AudioDecoderEXT.mm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,28 @@ of this software and associated documentation files (the "Software"), to deal
5252
BREAK_IF_ERR_LOG(fullPath.empty(), "Invalid path!");
5353

5454
_fileStream = FileUtils::getInstance()->openFileStream(fullPath, IFileStream::Mode::READ);
55-
BREAK_IF_ERR_LOG(_fileStream == nullptr, "FileUtils::openFileStream FAILED for file: %s", fullPath.data());
55+
BREAK_IF_ERR_LOG(_fileStream == nullptr, "FileUtils::openFileStream FAILED for file: {}", fullPath);
5656
if (_fileStream)
5757
{
5858
_streamSize = _fileStream->size(); // cache the stream size
5959
}
6060

6161
OSStatus status = AudioFileOpenWithCallbacks(this, &AudioDecoderEXT::readCallback, nullptr,
6262
&AudioDecoderEXT::getSizeCallback, nullptr, 0, &_audioFileId);
63-
BREAK_IF_ERR_LOG(status != noErr, "AudioFileOpenWithCallbacks FAILED, Error = %d", (int)status);
63+
BREAK_IF_ERR_LOG(status != noErr, "AudioFileOpenWithCallbacks FAILED, Error = {}", (int)status);
6464

6565
status = ExtAudioFileWrapAudioFileID(_audioFileId, false, &_extRef);
66-
BREAK_IF_ERR_LOG(status != noErr, "ExtAudioFileWrapAudioFileID FAILED, Error = %d", (int)status);
66+
BREAK_IF_ERR_LOG(status != noErr, "ExtAudioFileWrapAudioFileID FAILED, Error = {}", (int)status);
6767

68-
BREAK_IF_ERR_LOG(status != noErr, "ExtAudioFileOpenURL FAILED, Error = %d", (int)status);
68+
BREAK_IF_ERR_LOG(status != noErr, "ExtAudioFileOpenURL FAILED, Error = {}", (int)status);
6969

7070
AudioStreamBasicDescription fileFormat;
7171
UInt32 propertySize = sizeof(fileFormat);
7272

7373
// Get the audio data format
7474
status = ExtAudioFileGetProperty(_extRef, kExtAudioFileProperty_FileDataFormat, &propertySize, &fileFormat);
7575
BREAK_IF_ERR_LOG(status != noErr,
76-
"ExtAudioFileGetProperty(kExtAudioFileProperty_FileDataFormat) FAILED, Error = %d",
76+
"ExtAudioFileGetProperty(kExtAudioFileProperty_FileDataFormat) FAILED, Error = {}",
7777
(int)status);
7878
BREAK_IF_ERR_LOG(fileFormat.mChannelsPerFrame > 2, "Unsupported Format, channel count is greater than stereo!");
7979

@@ -97,16 +97,16 @@ of this software and associated documentation files (the "Software"), to deal
9797

9898
status = ExtAudioFileSetProperty(_extRef, kExtAudioFileProperty_ClientDataFormat, sizeof(_outputFormat),
9999
&_outputFormat);
100-
BREAK_IF_ERR_LOG(status != noErr, "ExtAudioFileSetProperty FAILED, Error = %d", (int)status);
100+
BREAK_IF_ERR_LOG(status != noErr, "ExtAudioFileSetProperty FAILED, Error = {}", (int)status);
101101

102102
// Get the total frame count
103103
SInt64 totalFrames = 0;
104104
propertySize = sizeof(totalFrames);
105105
status = ExtAudioFileGetProperty(_extRef, kExtAudioFileProperty_FileLengthFrames, &propertySize, &totalFrames);
106106
BREAK_IF_ERR_LOG(status != noErr,
107-
"ExtAudioFileGetProperty(kExtAudioFileProperty_FileLengthFrames) FAILED, Error = %d",
107+
"ExtAudioFileGetProperty(kExtAudioFileProperty_FileLengthFrames) FAILED, Error = {}",
108108
(int)status);
109-
BREAK_IF_ERR_LOG(totalFrames <= 0, "Total frames is 0, it's an invalid audio file: %s", fullPath.data());
109+
BREAK_IF_ERR_LOG(totalFrames <= 0, "Total frames is 0, it's an invalid audio file: {}", fullPath);
110110
_totalFrames = static_cast<uint32_t>(totalFrames);
111111
_isOpened = true;
112112

axmol/base/Director.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void Director::setDefaultValues()
252252
Image::setCompressedImagesHavePMA(Image::CompressedImagePMAFlag::ETC2, etc2_alpha_premultiplied);
253253
}
254254

255-
void Director::setGLDefaultValues()
255+
void Director::setRenderDefaults()
256256
{
257257
// This method SHOULD be called only after _renderView was initialized
258258
AXASSERT(_renderView, "render view should not be null");

axmol/base/Director.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,15 @@ class AX_DLL Director
395395
/** Sets the default values based on the Configuration info. */
396396
void setDefaultValues();
397397

398-
// OpenGL Helper
398+
// Render Helper
399399

400-
/** Sets the OpenGL default values.
400+
/** Sets the Render default values.
401401
* It will enable alpha blending, disable depth test.
402402
*/
403-
void setGLDefaultValues();
403+
void setRenderDefaults();
404+
#ifndef AX_CORE_PROFILE
405+
AX_DEPRECATED(2.9) void setGLDefaultValues() { setRenderDefaults(); }
406+
#endif
404407

405408
/** Sets clear values for the color buffers,
406409
* value range of each element is [0.0, 1.0].

axmol/network/Downloader-wasm.cpp

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,14 @@ static int sDownloaderCounter;
3737

3838
struct DownloadContextEmscripten : public IDownloadContext
3939
{
40-
explicit DownloadContextEmscripten(unsigned int id_) : id(id_), bytesReceived(0), fetch(NULL)
40+
explicit DownloadContextEmscripten(emscripten_fetch_t* fetch_) : fetch(fetch_)
4141
{
4242
AXLOGD("Construct DownloadContextEmscripten: {}", fmt::ptr(this));
4343
}
4444
virtual ~DownloadContextEmscripten() { AXLOGD("Destruct DownloadContextEmscripten: {}", fmt::ptr(this)); }
4545

46-
int bytesReceived;
47-
unsigned int id;
4846
emscripten_fetch_t* fetch;
49-
shared_ptr<const DownloadTask> task; // reference to DownloadTask, when task finish, release
47+
shared_ptr<DownloadTask> task; // reference to DownloadTask, when task finish, release
5048
};
5149

5250
DownloaderEmscripten::DownloaderEmscripten(const DownloaderHints& hints) : _id(++sDownloaderCounter), hints(hints)
@@ -86,26 +84,26 @@ void DownloaderEmscripten::startTask(std::shared_ptr<DownloadTask>& task)
8684
emscripten_fetch_t* fetch = emscripten_fetch(&attr, task->requestURL.c_str());
8785
fetch->userData = this;
8886

89-
auto context = new DownloadContextEmscripten(fetch->id);
87+
auto context = new DownloadContextEmscripten(fetch);
9088
context->task = task;
9189

92-
AXLOGD("DownloaderEmscripten::startTask context-id: {}", context->id);
93-
_taskMap.emplace(context->id, context);
90+
AXLOGD("DownloaderEmscripten::startTask fetch: {}", fmt::ptr(fetch));
91+
_taskMap.emplace(fetch, context);
9492
}
9593

9694
void DownloaderEmscripten::onDataLoad(emscripten_fetch_t* fetch)
9795
{
98-
unsigned int taskId = fetch->id;
99-
uint64_t size = fetch->numBytes;
100-
AXLOGD("DownloaderEmscripten::onDataLoad(taskId: {}, size: {})", taskId, size);
96+
int64_t size = fetch->totalBytes;
97+
AXLOGD("DownloaderEmscripten::onDataLoad(fetch: {}, size: {})", fmt::ptr(fetch), size);
10198
DownloaderEmscripten* downloader = reinterpret_cast<DownloaderEmscripten*>(fetch->userData);
102-
auto iter = downloader->_taskMap.find(taskId);
99+
auto iter = downloader->_taskMap.find(fetch);
103100
if (downloader->_taskMap.end() == iter)
104101
{
105-
AXLOGD("DownloaderEmscripten::onDataLoad can't find task with id: {}, size: {}", taskId, size);
102+
AXLOGD("DownloaderEmscripten::onDataLoad can't find task with fetch: {}, size: {}", fmt::ptr(fetch), size);
106103
return;
107104
}
108105
auto context = iter->second;
106+
updateTaskProgressInfo(*context->task, fetch);
109107
std::vector<unsigned char> buf(reinterpret_cast<const uint8_t*>(fetch->data),
110108
reinterpret_cast<const uint8_t*>(fetch->data) + size);
111109
emscripten_fetch_close(fetch);
@@ -119,17 +117,17 @@ void DownloaderEmscripten::onDataLoad(emscripten_fetch_t* fetch)
119117

120118
void DownloaderEmscripten::onLoad(emscripten_fetch_t* fetch)
121119
{
122-
unsigned int taskId = fetch->id;
123-
uint64_t size = fetch->numBytes;
124-
AXLOGD("DownloaderEmscripten::onLoad(taskId: {}, size: {})", taskId, size);
120+
int64_t size = fetch->totalBytes;
121+
AXLOGD("DownloaderEmscripten::onLoad(fetch: {}, size: {})", fmt::ptr(fetch), size);
125122
DownloaderEmscripten* downloader = reinterpret_cast<DownloaderEmscripten*>(fetch->userData);
126-
auto iter = downloader->_taskMap.find(taskId);
123+
auto iter = downloader->_taskMap.find(fetch);
127124
if (downloader->_taskMap.end() == iter)
128125
{
129-
AXLOGD("DownloaderEmscripten::onLoad can't find task with id: {}, size: {}", taskId, size);
126+
AXLOGD("DownloaderEmscripten::onLoad can't find task with fetch: {}, size: {}", fmt::ptr(fetch), size);
130127
return;
131128
}
132129
auto context = iter->second;
130+
updateTaskProgressInfo(*context->task, fetch);
133131
vector<unsigned char> buf;
134132
downloader->_taskMap.erase(iter);
135133

@@ -199,43 +197,43 @@ void DownloaderEmscripten::onLoad(emscripten_fetch_t* fetch)
199197

200198
void DownloaderEmscripten::onProgress(emscripten_fetch_t* fetch)
201199
{
202-
uint64_t dlTotal = fetch->totalBytes;
203-
uint64_t dlNow = fetch->dataOffset;
204-
unsigned int taskId = fetch->id;
205-
AXLOGD("DownloaderEmscripten::onProgress(taskId: {}, dlnow: {}, dltotal: {})", taskId, dlNow, dlTotal);
200+
AXLOGD("DownloaderEmscripten::onProgress(fetch: {}, dlnow: {}, dltotal: {})", fmt::ptr(fetch), fetch->dataOffset,
201+
fetch->totalBytes);
206202
DownloaderEmscripten* downloader = reinterpret_cast<DownloaderEmscripten*>(fetch->userData);
207-
auto iter = downloader->_taskMap.find(taskId);
203+
auto iter = downloader->_taskMap.find(fetch);
208204
if (downloader->_taskMap.end() == iter)
209205
{
210-
AXLOGD("DownloaderEmscripten::onProgress can't find task with id: {}", taskId);
206+
AXLOGD("DownloaderEmscripten::onProgress can't find task with fetch: {}", fmt::ptr(fetch));
211207
return;
212208
}
213209

214-
if (dlTotal == 0)
210+
if (fetch->totalBytes == 0)
215211
{
216-
AXLOGD("DownloaderEmscripten::onProgress dlTotal unknown, usually caused by unknown content-length header {}",
217-
taskId);
212+
AXLOGD(
213+
"DownloaderEmscripten::onProgress fetch totalBytes unknown, usually caused by unknown content-length "
214+
"header {}",
215+
fmt::ptr(fetch));
218216
return;
219217
}
220218

221-
auto context = iter->second;
222-
context->bytesReceived = dlNow;
219+
auto context = iter->second;
220+
updateTaskProgressInfo(*context->task, fetch);
223221
downloader->onTaskProgress(*context->task);
224222
}
225223

226224
void DownloaderEmscripten::onError(emscripten_fetch_t* fetch)
227225
{
228-
unsigned int taskId = fetch->id;
229-
AXLOGD("DownloaderEmscripten::onLoad(taskId: {})", taskId);
226+
AXLOGD("DownloaderEmscripten::onLoad(fetch: {})", fmt::ptr(fetch));
230227
DownloaderEmscripten* downloader = reinterpret_cast<DownloaderEmscripten*>(fetch->userData);
231-
auto iter = downloader->_taskMap.find(taskId);
228+
auto iter = downloader->_taskMap.find(fetch);
232229
if (downloader->_taskMap.end() == iter)
233230
{
234231
emscripten_fetch_close(fetch);
235-
AXLOGD("DownloaderEmscripten::onLoad can't find task with id: {}", taskId);
232+
AXLOGD("DownloaderEmscripten::onLoad can't find task with fetch: {}", fmt::ptr(fetch));
236233
return;
237234
}
238235
auto context = iter->second;
236+
updateTaskProgressInfo(*context->task, fetch);
239237
vector<unsigned char> buf;
240238
downloader->_taskMap.erase(iter);
241239
downloader->onTaskFinish(*context->task, DownloadTask::ERROR_IMPL_INTERNAL, fetch->status, fetch->statusText, buf);
@@ -244,5 +242,12 @@ void DownloaderEmscripten::onError(emscripten_fetch_t* fetch)
244242
context->fetch = fetch = NULL;
245243
context->task.reset();
246244
}
245+
246+
void DownloaderEmscripten::updateTaskProgressInfo(DownloadTask& task, emscripten_fetch_t* fetch)
247+
{
248+
task.progressInfo.bytesReceived = fetch->numBytes;
249+
task.progressInfo.totalBytesReceived = fetch->dataOffset;
250+
task.progressInfo.totalBytesExpected = fetch->totalBytes;
251+
}
247252
} // namespace network
248253
} // namespace ax

axmol/network/Downloader-wasm.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class DownloaderEmscripten : public IDownloaderImpl
5353

5454
DownloaderHints hints;
5555

56-
std::unordered_map<unsigned int, DownloadContextEmscripten*> _taskMap;
56+
std::unordered_map<emscripten_fetch_t*, DownloadContextEmscripten*> _taskMap;
5757

5858
static void onError(emscripten_fetch_t* fetch);
5959

@@ -62,6 +62,8 @@ class DownloaderEmscripten : public IDownloaderImpl
6262
static void onDataLoad(emscripten_fetch_t* fetch);
6363

6464
static void onLoad(emscripten_fetch_t* fetch);
65+
66+
static void updateTaskProgressInfo(DownloadTask& task, emscripten_fetch_t* fetch);
6567
};
6668

6769
} // namespace network

axmol/network/HttpClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ void HttpClient::handleNetworkEvent(yasio::io_event* event)
361361
auto requestDataSize = request->getRequestDataSize();
362362
char buf[128];
363363
auto strConentLen =
364-
fmt::format_to_z(buf, "Content-Length: %d\r\n\r\n", static_cast<int>(requestDataSize));
364+
fmt::format_to_z(buf, "Content-Length: {}\r\n\r\n", static_cast<int>(requestDataSize));
365365
obs.write_bytes(strConentLen);
366366

367367
if (requestData && requestDataSize > 0)

0 commit comments

Comments
 (0)