// File: /workspace/github_cpp_makefile_star2_O1/bluesky466[P]ResourcesParser/ResourcesParser.cpp
// Function: ResourcesParser::ResourcesParser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
ResourcesParser::ResourcesParser(const string& filePath) {
	ifstream resources(filePath, ios::in|ios::binary);

	// resources文件开头是个ResTable_header,记录整个文件的信息
	resources.read((char*)&mResourcesInfo, sizeof(ResTable_header));

	// 紧接着就是全局字符串池
	mGlobalStringPool = parserResStringPool(resources);
	if(mGlobalStringPool == nullptr) {
		return;
	}

	for(int i = 0 ; i < mResourcesInfo.packageCount ; i++) {
		PackageResourcePtr pResource = parserPackageResource(resources);
		if(pResource == nullptr) {
			return;
		}
		mResourceForId[pResource->header.id] = pResource;
		mResourceForPackageName[toUtf8((char16_t*)pResource->header.name)] = pResource;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
leaq 0x20(%rdi), %rax
movq %rax, -0x48(%rbp)
leaq 0x28(%rdi), %rax
xorl %ecx, %ecx
movl %ecx, 0x28(%rdi)
movq %rcx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movq %rax, 0x40(%rdi)
movq %rcx, 0x48(%rdi)
leaq 0x50(%rdi), %rax
movq %rax, -0x50(%rbp)
leaq 0x58(%rdi), %rax
movl %ecx, 0x58(%rdi)
movq %rcx, 0x60(%rdi)
movq %rax, 0x68(%rdi)
movq %rax, 0x70(%rdi)
movups %xmm0, 0x78(%rdi)
movups %xmm0, 0x88(%rdi)
leaq -0x2f8(%rbp), %rdi
movl $0xc, %edx
movq %r13, -0x40(%rbp)
callq 0x32e0
leaq -0x2f8(%rbp), %rdi
movl $0xc, %edx
movq %r13, %rsi
callq 0x3250
leaq -0xd0(%rbp), %rdi
leaq -0x2f8(%rbp), %rdx
callq 0x68be
movaps -0xd0(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0xd0(%rbp)
movq 0x18(%r13), %rdi
movups %xmm0, 0x10(%r13)
testq %rdi, %rdi
je 0x6635
callq 0x3dfa
leaq 0x10(%r13), %r14
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x664a
callq 0x3dfa
cmpq $0x0, (%r14)
je 0x67ed
cmpl $0x0, 0x8(%r13)
je 0x67ed
xorl %r12d, %r12d
leaq -0xd0(%rbp), %rbx
xorl %r14d, %r14d
leaq -0x38(%rbp), %rdi
movq %r13, %rsi
leaq -0x2f8(%rbp), %rdx
callq 0x6ac2
movq -0x38(%rbp), %rsi
testq %rsi, %rsi
je 0x67df
addq $0x8, %rsi
movq -0x50(%rbp), %rdi
callq 0x7656
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x785a
movq -0x38(%rbp), %rdx
leaq 0xc(%rdx), %rsi
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
addq $0xa, %rdx
cmpw $0x0, 0x2(%rdx)
leaq 0x2(%rdx), %rdx
jne 0x66c4
leaq -0x70(%rbp), %rdi
callq 0x7d8e
movl $0x20, %edi
callq 0x3200
movl %r12d, 0x8(%rax)
movq $0x10ffff, 0x10(%rax)   # imm = 0x10FFFF
movl %r12d, 0x18(%rax)
leaq 0x844f(%rip), %rcx      # 0xeb48
movq %rcx, (%rax)
movq %rax, -0xd0(%rbp)
leaq -0xb8(%rbp), %rcx
movq %rcx, -0xc8(%rbp)
movq %r12, -0xc0(%rbp)
movb $0x0, -0xb8(%rbp)
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq %r12, -0xa0(%rbp)
movw %r12w, -0x98(%rbp)
movw %r12w, 0x40(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rcx)
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rax
leaq (%rdx,%rax,2), %rcx
leaq -0xf0(%rbp), %r13
movq %r13, %rdi
movq %rbx, %r15
movq %rbx, %rsi
callq 0x7906
movq %r15, %rdi
callq 0x78a0
movq -0x48(%rbp), %rdi
movq %r13, %rsi
callq 0x76be
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x785a
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
movq -0x40(%rbp), %r13
je 0x67b0
callq 0x31d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x67c2
callq 0x31d0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x67d0
callq 0x3dfa
incl %r14d
cmpl 0x8(%r13), %r14d
jb 0x666c
jmp 0x67ed
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x67ed
callq 0x3dfa
leaq -0x2f8(%rbp), %rdi
callq 0x3070
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x686e
jmp 0x686e
movq %rax, %r14
jmp 0x687d
movq %rax, %r14
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x684c
callq 0x31d0
jmp 0x684c
jmp 0x6844
movq %rax, %r14
leaq -0xd0(%rbp), %rdi
callq 0x78a0
jmp 0x684c
movq %rax, %r14
jmp 0x685e
movq %rax, %r14
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x685e
callq 0x31d0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x6871
callq 0x3dfa
jmp 0x6871
movq %rax, %r14
leaq -0x2f8(%rbp), %rdi
callq 0x3070
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rdi
testq %rdi, %rdi
je 0x6892
callq 0x31d0
movq -0x50(%rbp), %rdi
callq 0x3d94
movq -0x48(%rbp), %rdi
callq 0x3e66
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdi
testq %rdi, %rdi
je 0x68b6
callq 0x3dfa
movq %r14, %rdi
callq 0x3340