Resource processing method and device, equipment, storage medium and program product
By recording the identity of all dependent resource packages in the dependency information of the resource package and using batch construction of dependencies, the problem of low resource loading efficiency in the existing technology is solved, and a more efficient resource loading and production process is achieved.
Patent Information
- Application Number
- CN202411721906.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-21
AI Technical Summary
The existing resource processing methods are inefficient and consumed when loading resources, mainly due to recursive search of dependency information of multiple resource packages.
By recording the identity of all other resource packages it depends on in the dependency information of each resource package, a resource dependency relationship is built in batches instead of recursive searches.
The production logic of resource packages is simplified, the production efficiency of resource packages is improved, and the processing resource consumption during resource loading is saved, which improves resource loading efficiency.
Smart Images

Figure CN119668715A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a resource processing method, device, equipment, storage medium and program product. Background Art
[0002] As application functions become more and more abundant, the resources required (such as code files, configuration information, pictures, audio, video, etc.) are also increasing. In order to facilitate resource management, speed up resource loading, meet hot update requirements, etc., a resource processing method has emerged that packages different resources into independent resource packages, and can additionally store dependency information of other resource packages that the main package directly depends on in the resource package. In this way, during the resource loading process, a complete resource dependency relationship can be constructed by recursively parsing the dependency information in each resource package, and the resources in all resource packages can be loaded according to the complete resource dependency relationship. However, this resource processing method consumes a lot of processing resources and has low resource loading efficiency. Summary of the invention
[0003] In order to solve the above technical problems, the embodiments of the present disclosure provide a resource processing method, apparatus, device, storage medium and program product.
[0004] In a first aspect, an embodiment of the present disclosure provides a resource processing method, the method comprising:
[0005] In response to a start-up operation of a target function, a plurality of resource packages corresponding to the target function are determined; wherein the resource packages at least include dependency information and resources; the dependency information includes an identifier of each resource package having a dependency relationship with the entity resource package;
[0006] Based on the identifiers in the dependency information in the target resource package, determine the dependent resource packages in the resource packages that have a dependency relationship with the target resource package; wherein the target resource package is any one of the resource packages;
[0007] The resources in the target resource package and the resources with dependency relationships in each of the dependent resource packages are loaded into the memory to generate memory data corresponding to the target function.
[0008] In a second aspect, an embodiment of the present disclosure further provides a resource processing device, the device comprising:
[0009] A resource package determination module, configured to determine, in response to a start-up operation of a target function, a plurality of resource packages corresponding to the target function; wherein the resource package at least includes dependency information and resources; the dependency information includes an identifier of each resource package having a dependency relationship with the entity resource package;
[0010] A dependent resource package determination module, used to determine each dependent resource package having a dependency relationship with the target resource package based on each of the identifiers in the dependency information in the target resource package; wherein the target resource package is any one of the resource packages;
[0011] The resource loading module is used to load the resources in the target resource package and the resources with dependency relationships in each of the dependent resource packages into the memory, and generate memory data corresponding to the target function.
[0013] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0014] processor;
[0015] A memory for storing executable instructions;
[0016] The processor is used to read executable instructions from the memory and execute the executable instructions to implement the resource processing method described in any embodiment of the present disclosure.
[0017] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the resource processing method described in any embodiment of the present disclosure.
[0018] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which is used to execute the resource processing method described in any embodiment of the present disclosure.
[0019] The resource processing method, apparatus, device, storage medium and program product of the disclosed embodiments can determine multiple resource packages corresponding to the target function in response to the startup operation of the target function; the resource package at least includes dependency information and resources; the dependency information includes the identifiers of each resource package that has a dependency relationship with the main resource package; based on each identifier in the dependency information of any target resource package in each resource package, each dependent resource package in each resource package that has a dependency relationship with the target resource package is determined; the resources in the target resource package and the resources with a dependency relationship in each dependent resource package are loaded into the memory to generate memory data corresponding to the target function; in this way, by recording the identifiers of all other resource packages on which each resource package depends in the dependency information of each resource package, the complete resource dependency relationship required by the resource package can be obtained by parsing one resource package; on the one hand, the resource package maker no longer needs to consider the complex dependency relationship between different resource packages, which simplifies the resource package production logic and improves the resource package production efficiency; on the other hand, it saves the processing resource consumption of recursively searching multiple resource packages during resource loading, thereby improving the resource loading efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0021] Figure 1 A schematic diagram of a storage structure of a resource package in the related art;
[0022] Figure 2 A schematic diagram of a process flow of a resource processing method provided by an embodiment of the present disclosure;
[0023] Figure 3 A schematic diagram of a storage structure of a resource package provided in an embodiment of the present disclosure;
[0024] Figure 4 A flowchart of another resource processing method provided by an embodiment of the present disclosure;
[0025] Figure 5 A schematic diagram of a resource processing process provided by an embodiment of the present disclosure;
[0026] Figure 6 A schematic diagram of the structure of a resource processing device provided in an embodiment of the present disclosure;
[0027] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0029] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0030] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0031] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0034] In the related art, there is a resource processing method that packages different resources (such as code files, models (Mesh), textures (Texture), materials (Material), scenes (Scene), audio, video, etc.) into independent resource packages, and carries information about other resource packages that the resource package directly depends on when using it (i.e., dependency information) in the resource package. Figure 1, for the resource package with the package body identified as 1 (such as the resource package corresponding to the interface), it contains meta information, dependency information and specific resource 1, and the dependency information points to resource 2 in the resource package identified as 2 that resource package 1 directly depends on; resource package 2 (such as the resource package of a certain picture in the interface) contains meta information, dependency information and specific resource 2, and the dependency information points to resource 3 in the resource package identified as 3 that resource package 2 directly depends on; resource package 3 (such as the resource package of the effect resource in the picture) contains meta information, dependency information and specific resource 3, and the dependency information points to resource 4 in the resource package identified as 4 that resource package 3 directly depends on; resource package 4 (such as the resource package of the configuration information of the effect resource) contains meta information, dependency information and specific resource 4, and the dependency information is empty, indicating that resource package 4 does not depend on other resource packages. Then, the process of loading the above interface is the process of downloading and loading the above four resource packages. During the loading process, the electronic device first deserializes resource package 1 and creates memory, and then recursively searches for its dependency information to obtain resource package 2; then, it deserializes resource package 2 and continues to build resources in memory, and then recursively searches for its dependency information to obtain resource package 3; then, it deserializes resource package 3 and continues to build resources in memory, and then recursively searches for its dependency information to obtain resource package 4; finally, it deserializes resource package 4 and continues to build resources in memory, thereby loading the resources required for the interface into memory.
[0035] From the above process, it can be seen that the method of storing information with direct resource dependencies in a resource package will increase the cost of computing resources due to the recursive search processing during resource loading, thereby causing the problem of low resource loading efficiency.
[0036] Continue to see Figure 1 In order to solve the above problems, the four resource packages can be integrated into a large resource package. In this way, there is no recursive search process for dependency information. Instead, the large resource package is directly deserialized to realize the construction of memory resources, thereby improving the efficiency of resource loading. However, this resource processing method packages all related resources into one resource package, which will have the following problems: when a resource package is dependent on multiple other resource packages, there will be more redundant and repeated resource packages, wasting traffic and storage space; and if any data in the resource package needs to be changed, then the entire resource package needs to be changed, and the data change cost is high; in addition, after loading the above resource package, if the resources cannot be released, the memory usage is relatively large.
[0037] Based on the above situation, the embodiment of the present disclosure provides a resource processing solution to change the dependency information in each resource package from the identifier of the directly dependent resource package to the identifier of all the resource packages it depends on, thereby changing the construction of the dependency relationship from a recursive method to a batch method. In this way, on the one hand, all the resource packages that a resource package depends on can be determined without recursive search, saving the computing resource overhead of building a complete dependency relationship, and thus improving the resource loading efficiency; on the other hand, the duplication of dependency information is much smaller than the duplication of resource packages, and will not occupy too much storage space and consume too much traffic; on the other hand, each resource package still has an independent relationship, and the change of data, loading and releasing of resources, etc. are flexible, and the implementation cost is low.
[0038] The resource processing method provided by the embodiment of the present disclosure can be applied to the scenario of realizing certain application functions by loading multiple independent resource packages mentioned above; for example, it can be applied to the scenario of downloading and loading game resources in the process of running the game through application programs, web pages or applets. The method can be executed by a resource processing device, which can be implemented by software and / or hardware, and the device can be integrated in an electronic device with certain resource download and loading processing functions. The electronic device can include but is not limited to smart home devices such as smart phones, personal digital assistants (PDAs), tablet computers (Tablet Personal Computers, Tablet PCs), digital televisions, laptop computers, desktop computers, servers, server clusters, etc.
[0039] Figure 2 FIG. 1 is a flow chart of a resource processing method provided by an embodiment of the present disclosure. Figure 1 As shown, the resource processing method may include the following steps:
[0040] S210. In response to a start-up operation of a target function, a plurality of resource packages corresponding to the target function are determined; the resource package at least includes dependency information and resources; the dependency information includes identifiers of resource packages having a dependency relationship with the entity resource package.
[0041] Among them, the target function is the application function to be realized presented in the form of an application, web page or applet, for example, it can be a level in a game, a scene in a virtual reality application, a special effect application function in shooting or editing, etc. The resource package is the result of packaging relatively independent resources and their related information, which can be a file or other data structure that is convenient for network transmission. Dependency information is information that characterizes the dependency relationship of resources within the resource package on resources outside the resource package, for example, it can be the identifier of the dependent resource package (referred to as the dependent resource package). The identifier of the resource package can be, for example, the package name of the resource package, the access path, etc.
[0042] Specifically, based on the above description, in order to avoid the process of recursively searching multiple resource packages to build a complete dependency relationship during resource loading, in the embodiment of the present disclosure, in the process of making a resource package, the resource package identifiers of the resources that the resources in a certain resource package depend on can be directly written into the dependency information of the resource package (i.e., the main resource package). In this way, the producer does not need to consider the complex dependency relationship between the resource packages, which improves the producer's efficiency; moreover, when processing a resource package, there is no need to build a complete dependency relationship from other resource packages.
[0043] In specific implementation, the user can start the target function through channels such as applications, web pages or applets. For example, the user can start a game application or click to enter the next level of the game. The user's startup operation will trigger the electronic device to obtain all resource packages required for the target function. The dependency information of each resource package contains the identifiers of all dependent resource packages it depends on. For example, when the electronic device has the resource package required for the target function locally, it can directly obtain the corresponding resource package from the local storage space. If a resource package is not stored in the local storage space, the electronic device can download and obtain the resource package from the relevant server according to the target function. In this way, the electronic device can obtain all the resource packages required for the target function.
[0044] See also Figure 3 , taking the above interface loading as an example, the user executes the operation to start the interface. The electronic device then downloads the four resource packages corresponding to the interface - resource package 1 (corresponding to the interface), resource package 2 (corresponding to the picture), resource package 3 (corresponding to the effect) and resource package 4 (corresponding to the configuration information of the effect). The dependency information of resource package 1 contains resource package identifier 2, identifier 3 and identifier 4, indicating that resource package 1 depends on resource package 2, resource package 3 and resource package 4. The dependency information of resource package 2 contains resource package identifier 3 and identifier 4, indicating that resource package 2 depends on resource package 3 and resource package 4. The dependency information of resource package 3 contains resource package identifier 4, indicating that resource package 3 depends on resource package 4. The dependency information of resource package 4 is empty, indicating that it does not depend on other resource packages.
[0045] It should be noted that if there is more than one resource in the dependent resource package, the dependency information may record the identifier of the dependent resource package and the identifier of the specific resource. Figure 3 For example, assuming that resource bundle 1 depends on resource 2 in resource bundle 2, then its dependency information may include the identifier of resource 2 in addition to the identifier of resource bundle 2.
[0046] S220: Determine, based on the identifiers in the dependency information in the target resource bundle, the dependent resource bundles in the resource bundles that have a dependency relationship with the target resource bundle.
[0047] The target resource package is any one of the resource packages corresponding to the target function.
[0048] Specifically, after the electronic device has determined each resource package, it can load it into the memory to form memory data. Before performing the loading operation, the complete dependency relationship of each resource package is obtained to ensure the correctness and completeness of resource loading. Therefore, for any target resource package in each resource package, the electronic device can read its dependency information and determine all dependent resource packages that the target resource package depends on. In this way, when loading each resource package, there is no need to deserialize other resource packages to obtain their complete dependency relationships, but only to read the dependency information in the package body, thereby speeding up resource loading efficiency.
[0049] S230: Load the resources in the target resource package and the resources with dependency relationships in each dependent resource package into the memory, and generate memory data corresponding to the target function.
[0050] Specifically, the electronic device can deserialize the target resource package and each dependent resource package determined in the above steps to obtain the resources that have a dependent relationship with the target resource package, and then parse each resource as needed and load it into the memory to construct the memory data corresponding to the target function.
[0051] In one example, a resource package is stored in an independent folder, and the electronic device opens the folders one by one to obtain corresponding resources.
[0052] In another example, the electronic device can store each resource package in a folder for management. In this way, the electronic device only needs to open a folder to obtain the required resources. In this way, the process of opening and closing folders can be reduced, and the resource loading efficiency can be further improved. The specific explanation of managing each resource package through a folder can be found in the detailed description of each subsequent embodiment.
[0053] The resource processing method provided by the above-mentioned embodiments of the present disclosure can determine multiple resource packages corresponding to the target function in response to the startup operation of the target function; the resource package at least includes dependency information and resources; the dependency information includes the identifiers of each resource package that has a dependency relationship with the main resource package; based on each identifier in the dependency information of any target resource package in each resource package, each dependent resource package that has a dependency relationship with the target resource package is determined; the resources in the target resource package and the resources with dependency relationships in each dependent resource package are loaded into the memory to generate memory data corresponding to the target function; in this way, by recording the identifiers of all other resource packages on which each resource package depends in the dependency information of each resource package, the complete resource dependency relationship required by the resource package can be obtained by parsing one resource package; on the one hand, the resource package maker no longer needs to consider the complex dependency relationship between different resource packages, which simplifies the production logic of the resource package and improves the production efficiency of the resource package; on the other hand, it saves the processing resource consumption of recursively searching multiple resource packages during the resource loading process, thereby improving the resource loading efficiency.
[0054] Figure 4 It is a flowchart of another resource processing method provided by an embodiment of the present disclosure. Based on the above embodiments, the resource processing method adds the relevant content of using a virtual file system to store resource packages. On this basis, the relevant content of reading and writing resources from virtual files can be further added. The explanation of the same or similar terms and steps as those in the above embodiments can be found in the relevant descriptions of the above embodiments, and will not be repeated here.
[0055] See also Figure 4 , the resource processing method may specifically include the following steps:
[0056] S410. In response to a start operation of a target function, determine a plurality of resource packages corresponding to the target function; the resource package at least includes dependency information, resources, a first resource start position, and a first resource length.
[0057] The first resource start position is the start writing position of the resource package when it is stored in the virtual file, for example, it can be a byte offset relative to the file header. The first resource length is the data length occupied by the resource package when it is stored in the virtual file.
[0058] Specifically, in order to store multiple resource packages in the same folder for management, the creator of the resource package can specify the first resource starting position and first resource length of each resource package when writing the virtual file during the creation process. In this way, each resource package also carries the two pieces of information.
[0059] S420: Call the file creation interface of the virtual file system to create a target virtual file.
[0060] The creation interface is a function calling interface provided by the virtual file system and used to create a virtual file.
[0061] Specifically, the electronic device creates a set of virtual file systems through the unified file system in advance, and provides a universal interface for updating and loading. Various engines can adapt to the corresponding interface. In this way, the electronic device has the function of managing resource packages through the virtual file system.
[0062] In specific implementation, the electronic device mounts the virtual file system. After downloading each resource package, the electronic device can call the file creation interface of the virtual file system to create a virtual file to store the downloaded resource package. The virtual file can be called a target virtual file.
[0063] S430: Based on the first resource start position and the first resource length of each resource package, call the write interface of the virtual file system to write each resource package into the target virtual file, so as to access each resource package through the target virtual file.
[0064] The write interface is a function call interface provided by the virtual file system and used to store data in a virtual file.
[0065] Specifically, the electronic device performs the same storage operation for each downloaded resource package: reads the first resource starting position and the first resource length of the resource package, and uses them as function parameters to call the write interface of the virtual file system through the target virtual file to write the resource package from the first resource starting position, and ends the storage operation of the resource package after writing the first resource length. In this way, each resource package can be stored in the same target virtual file, and the correctness and integrity of the data of the resource package can be ensured. In the subsequent processing of each resource package, each resource package can be accessed by accessing the target virtual file.
[0066] See also Figure 5The electronic device reads the first resource starting position 1 (file header position) and the first resource length 1 from resource package 1, and calls the write interface to write resource package 1 from the file header position of the target virtual file until the write length reaches the first resource length 1, and completes the storage of resource package 1; reads the first resource starting position 2 and the first resource length 2 from resource package 2, and calls the write interface to write resource package 2 from the first resource starting position 2 of the target virtual file until the write length reaches the first resource length 2, and completes the storage of resource package 2; reads the first resource starting position 2 and the first resource length 2 from resource package 2, and calls the write interface to write resource package 2 from the first resource starting position 2 of the target virtual file until the write length reaches the first resource length 2, and completes the storage of resource package 2; Resource package 2 is written starting from the first resource starting position 2 of the target virtual file until the written length reaches the first resource length 2, thereby completing the storage of resource package 2; the first resource starting position 3 and the first resource length 3 are read from resource package 3, and the write interface is called to write resource package 3 starting from the first resource starting position 3 of the target virtual file until the written length reaches the first resource length 3, thereby completing the storage of resource package 3; the first resource starting position 4 and the first resource length 4 are read from resource package 4, and the write interface is called to write resource package 4 starting from the first resource starting position 4 of the target virtual file until the written length reaches the first resource length 4, thereby completing the storage of resource package 4.
[0067] S440: Determine each dependent resource bundle having a dependency relationship with the target resource bundle based on each identifier in the dependency information of the target resource bundle in the target virtual file.
[0068] S450. Based on the starting position of the first resource and the length of the first resource, call the file opening interface and the reading interface of the virtual file system, read the resources in the target resource package and the resources with dependencies in each dependent resource package from the target virtual file, load each resource into the memory, and generate memory data corresponding to the target function.
[0069] Specifically, the electronic device can first call the file opening interface of the virtual file system through the target virtual file to open the target virtual file. Then, according to the first resource starting position and first resource length of each resource package, as well as the dependency information, the required resources in the resource package are read on demand. Figure 5, resource package 2 depends on resource package 3 and resource package 4, then, the electronic device can read data from the first resource starting position 2 of resource package 2 until the first resource length 2 is reached, and resource 2 can be obtained therefrom; then, the electronic device can read data from the first resource starting position 3 of resource package 3 until the first resource length 3 is reached, and resource 3 can be obtained therefrom; read data from the first resource starting position 4 of resource package 4 until the first resource length 4 is reached, and resource 4 can be obtained therefrom. In this way, all the resources required by resource package 2 can be obtained. Afterwards, the electronic device can load all the read resources into the memory and generate corresponding memory data. In this way, the electronic device can read all the required resources by performing only one file opening operation of opening the target virtual file, reducing the operation of opening multiple files to read resources in different resource packages in the related art, thereby further improving the resource loading efficiency.
[0070] S460: In response to the resource change operation, based on the second resource start position and the second resource length corresponding to the resource change operation, change the resource package in the target virtual file.
[0071] Among them, the resource change operation is an operation to change (such as adding, modifying or deleting, etc.) the resources in the target virtual file. The second resource starting position is the starting position when the resources in the virtual file are changed, for example, it can be a byte offset relative to the file header. The second resource length is the data length covered by the change operation when the resources in the virtual file are changed. For example, when the resource change operation is a resource addition operation of adding new resources to the target virtual file, the second resource starting position and the second resource length respectively indicate where to start inserting the newly added resources and how long the data space occupied by the newly added resources; when the resource change operation is a resource deletion operation of deleting resources from the target virtual file, the second resource starting position and the second resource length respectively indicate where to start deleting resources and how long the resources are deleted; when the resource change operation is a resource modification operation of modifying resources in the target virtual file, the second resource starting position and the second resource length respectively indicate where to start modifying and how long the resources are modified, etc.
[0072] Specifically, since each resource package is stored in the target virtual file in the form of a byte stream, there is a clear storage location between the resources of each resource package, rather than the related technology in which each resource is stored as a whole file. Therefore, the electronic device can change these resources according to the position and length of the byte stream to reduce the granularity of resource management and improve resource management efficiency.
[0073] In specific implementation, relevant personnel can perform a resource change operation, and the electronic device receives and analyzes the resource change operation to obtain the corresponding second resource starting position and second resource length. Then, according to the second resource starting position and the second resource length, the resource change operation corresponding to the resource change operation is performed on each resource stored in the target virtual file.
[0074] In some embodiments, S460 can be implemented as follows: in response to a resource addition operation, determine the second resource starting position, second resource length and newly added resource package corresponding to the resource addition operation; based on the second resource starting position and the second resource length, call the write interface of the virtual file system to write the newly added resource package into the target virtual file.
[0075] Specifically, if the user performs a new function startup operation on a client presented in the form of an application, web page or applet (such as opening a new game level or adopting a new editing effect, etc.), the electronic device will trigger the download and loading of a new resource package (i.e., a newly added resource package) in response to these operations performed by the user. The newly added resource package carries the second resource starting position and the second resource length that should be written to the target virtual file. Then, the electronic device can call the write interface of the virtual file system through the target virtual file, and write the newly added resource package from the second resource starting position until the write length reaches the second resource length and stops. In this way, new resource packages can continue to be added to the target virtual file.
[0076] In other embodiments, S460 can be implemented as: in response to a resource deletion operation, determining a second resource starting position and a second resource length corresponding to the resource deletion operation; based on the second resource starting position and the second resource length, calling a deletion interface of the virtual file system to delete the resource specified by the resource deletion operation from the target virtual file.
[0077] Specifically, if the user executes the closing of the target function or part of the target function through the client, or the server issues a service update request to close a part of the function, the electronic device can detect such resource deletion operation. Then, the electronic device can determine the second resource starting position and the second resource length of the resource to be deleted in the target virtual file through the resource deletion operation. Then, the electronic device calls the deletion interface of the virtual file system through the target virtual file, starts to delete the resource from the second resource starting position of the target virtual file until the deletion length reaches the second resource length, and deletes the resource corresponding to the resource deletion operation from the target virtual file.
[0078] In some further embodiments, S460 may be implemented as follows: in response to a resource modification operation, determining a second resource starting position, a second resource length, and a modified resource corresponding to the resource modification operation; based on the second resource starting position and the second resource length, calling a write interface of the virtual file system to write the modified resource into the target virtual file to overwrite the original resource at the corresponding position.
[0079] Specifically, if the user performs an operation to replace the target function or part of its functions through the client (such as changing the existing effects of the pictures presented in the interface to other effects, or using other effects for video editing, etc.), or the server issues a business update request to change a certain part of the function, etc., the electronic device can detect this type of resource modification operation. Then, the electronic device can determine through the resource modification operation that the resource to be modified corresponds to the second resource starting position and the second resource length in the target virtual file, and can obtain the modified resource (such as the resource of the effect / special effect of the new application). Then, the electronic device calls the write interface of the virtual file system through the target virtual file, writes the modified resource from the second resource starting position of the target virtual file until the write length reaches the second resource length, and then uses the modified resource to write over the original resource at the corresponding position to complete the resource modification process.
[0080] The above embodiments of the present disclosure create a target virtual file by calling the file creation interface of the virtual file system; based on the first resource starting position and the first resource length of each resource package, call the write interface of the virtual file system to write each resource package into the target virtual file; realize that each resource package is stored in the same target virtual file, and ensure the correctness and integrity of the resource package storage. By calling the file opening interface and the reading interface of the virtual file system based on the first resource starting position and the first resource length, the target resource package and the resources in each dependent resource package are read from the target virtual file, and the resources are loaded into the memory to generate the memory data corresponding to the target function; realize that only one file opening operation of opening the target virtual file is performed to read all the required resources, reducing the operation of opening multiple files to read resources in different resource packages in the related art, thereby further improving the resource loading efficiency. By responding to the resource change operation, based on the second resource starting position and the second resource length corresponding to the resource change operation, the resource package in the target virtual file is changed; on the basis of the byte stream of the virtual file, the granularity of resource management is reduced, thereby improving the precision, accuracy and efficiency of resource management.
[0081] The following is an embodiment of a resource processing device provided in an embodiment of the present invention. The device and the resource processing methods of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the resource processing device, reference can be made to the above-mentioned embodiment of the resource processing method.
[0082] Figure 6 FIG. 1 shows a schematic diagram of the structure of a resource processing device provided by an embodiment of the present disclosure. Figure 6 As shown, the resource processing device 600 may include:
[0083] The resource package determination module 610 is used to determine a plurality of resource packages corresponding to the target function in response to the start operation of the target function; wherein the resource package at least includes dependency information and resources; the dependency information includes the identifiers of each resource package having a dependency relationship with the ontology resource package;
[0084] A dependent resource package determination module 620 is used to determine the dependent resource packages having a dependency relationship with the target resource package based on the identifiers in the dependency information in the target resource package; wherein the target resource package is any one of the resource packages;
[0085] The resource loading module 630 is used to load the resources in the target resource package and the resources with dependency relationships in each dependent resource package into the memory, and generate memory data corresponding to the target function.
[0086] The resource processing device provided by the embodiment of the present disclosure can determine multiple resource packages corresponding to the target function in response to the startup operation of the target function; the resource package at least includes dependency information and resources; the dependency information includes the identifiers of each resource package that has a dependency relationship with the corresponding resource package; based on each identifier in the dependency information of any target resource package in each resource package, each dependent resource package that has a dependency relationship with the target resource package is determined; the resources in the target resource package and the resources with dependency relationships in each dependent resource package are loaded into the memory to generate memory data corresponding to the target function; in this way, by recording the identifiers of all other resource packages on which each resource package depends in the dependency information of each resource package, the complete dependency relationship required by the resource package can be obtained by parsing one resource package; on the one hand, the resource package maker no longer needs to consider the complex dependency relationships between different resource packages, which simplifies the resource package production logic and improves the resource package production efficiency; on the other hand, it saves the processing resource consumption of recursively searching multiple resource packages during resource loading, thereby improving the resource loading efficiency.
[0087] In some embodiments, the resource package further includes a first resource start position and a first resource length;
[0088] Accordingly, the resource processing device 600 further includes a resource writing module, which is used to:
[0089] In response to the start operation of the target function, after determining a plurality of resource packages corresponding to the target function, calling a file creation interface of the virtual file system to create a target virtual file;
[0090] Based on the first resource start position and the first resource length of each resource package, the write interface of the virtual file system is called to write each resource package into the target virtual file, so as to access each resource package through the target virtual file.
[0091] In some embodiments, the resource loading module 630 is specifically used to:
[0092] Based on the starting position of the first resource and the length of the first resource, the file opening interface and the reading interface of the virtual file system are called to read the resources in the target resource package and the resources with dependencies in each dependent resource package from the target virtual file, and load each resource into the memory to generate memory data corresponding to the target function.
[0093] In some embodiments, the resource processing device 600 further includes a resource change module, which is used to:
[0094] Based on the first resource starting position and the first resource length of each resource package, the write interface of the virtual file system is called to write each resource package to the target virtual file. Then, in response to the resource change operation, the resource package in the target virtual file is changed based on the second resource starting position and the second resource length corresponding to the resource change operation.
[0095] In some embodiments, the resource change module is specifically used to:
[0096] In response to the resource adding operation, determining a second resource starting position, a second resource length, and a newly added resource package corresponding to the resource adding operation;
[0097] Based on the second resource start position and the second resource length, the write interface of the virtual file system is called to write the newly added resource package into the target virtual file.
[0098] In some other embodiments, the resource change module is specifically used to:
[0099] In response to the resource deletion operation, determining a second resource starting position and a second resource length corresponding to the resource deletion operation;
[0100] Based on the second resource start position and the second resource length, a deletion interface of the virtual file system is called to delete the resource specified by the resource deletion operation from the target virtual file.
[0101] In some further embodiments, the resource change module is specifically used to:
[0102] In response to the resource modification operation, determining a second resource starting position, a second resource length, and a modified resource corresponding to the resource modification operation;
[0103] Based on the second resource start position and the second resource length, the write interface of the virtual file system is called to write the modified resource into the target virtual file to overwrite the original resource at the corresponding position.
[0104] The resource processing device provided in the embodiment of the present invention can execute the resource processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0105] It is worth noting that in the embodiment of the above-mentioned resource processing device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this disclosure.
[0106] The embodiment of the present disclosure also provides an electronic device, which may include a processor and a memory, wherein the memory may be used to store executable instructions. The processor may be used to read the executable instructions from the memory and execute the executable instructions to implement the resource processing method in the above embodiment.
[0107] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown.
[0108] like Figure 7 As shown, the electronic device 700 may include a processing device 701 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output interface (I / O interface) 705 is also connected to the bus 704.
[0109] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data.
[0110] It should be noted that Figure 7 The electronic device 700 shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure. Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0111] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 709, or installed from the storage device 708, or installed from the ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the resource processing method of any embodiment of the present disclosure are executed.
[0112] The embodiments of the present disclosure further provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the resource processing method in any embodiment of the present disclosure.
[0113] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0114] In some embodiments, the client and server may communicate using any currently known or future developed network protocol such as HTTP, and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0115] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0116] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the resource processing method described in any embodiment of the present disclosure.
[0117] In embodiments of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0118] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0119] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0120] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0121] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
[0122] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0123] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A resource processing method, characterized in that: include: In response to a start-up operation of a target function, a plurality of resource packages corresponding to the target function are determined; wherein the resource packages at least include dependency information and resources; the dependency information includes an identifier of each resource package having a dependency relationship with the entity resource package; Based on the identifiers in the dependency information in the target resource package, determine the dependent resource packages in the resource packages that have a dependency relationship with the target resource package; wherein the target resource package is any one of the resource packages; The resources in the target resource package and the resources with dependency relationships in each of the dependent resource packages are loaded into the memory to generate memory data corresponding to the target function.
2. The method according to claim 1, characterized in that The resource package also includes a first resource starting position and a first resource length; After determining a plurality of resource packages corresponding to the target function in response to the start-up operation of the target function, the method further includes: Call the file creation interface of the virtual file system to create the target virtual file; Based on the first resource starting position and the first resource length of each resource package, the write interface of the virtual file system is called to write each resource package into the target virtual file, so as to access each resource package through the target virtual file.
3. The method according to claim 2, characterized in that The step of loading the resources in the target resource package and the resources having dependency relationships in each of the dependent resource packages into the memory to generate memory data corresponding to the target function includes: Based on the starting position of the first resource and the length of the first resource, the file opening interface and the reading interface of the virtual file system are called, the resources in the target resource package and the resources with dependencies in each of the dependent resource packages are read from the target virtual file, and each of the resources is loaded into the memory to generate memory data corresponding to the target function.
4. The method according to claim 2, characterized in that: After calling the write interface of the virtual file system based on the first resource start position and the first resource length of each resource package to write each resource package into the target virtual file, the method further includes: In response to the resource change operation, the resource package in the target virtual file is changed based on the second resource start position and the second resource length corresponding to the resource change operation.
5. The method according to claim 4, characterized in that In response to the resource change operation, based on the second resource starting position and the second resource length corresponding to the resource change operation, the resource package in the target virtual file is changed, including: In response to a resource adding operation, determining the second resource starting position, the second resource length, and the newly added resource package corresponding to the resource adding operation; Based on the second resource starting position and the second resource length, the write interface of the virtual file system is called to write the newly added resource package into the target virtual file.
6. The method according to claim 4, characterized in that In response to the resource change operation, based on the second resource starting position and the second resource length corresponding to the resource change operation, the resource package in the target virtual file is changed, including: In response to a resource deletion operation, determining a second resource starting position and a second resource length corresponding to the resource deletion operation; Based on the second resource starting position and the second resource length, a deletion interface of the virtual file system is called to delete the resource specified by the resource deletion operation from the target virtual file.
7. The method according to claim 4, characterized in that In response to the resource change operation, based on the second resource starting position and the second resource length corresponding to the resource change operation, performing change processing on the resource package in the target virtual file includes: In response to a resource modification operation, determining a second resource starting position, a second resource length, and a modified resource corresponding to the resource modification operation; Based on the second resource starting position and the second resource length, the write interface of the virtual file system is called to write the modified resource into the target virtual file to overwrite the original resource at the corresponding position.
8. A resource processing device, characterized in that: include: A resource package determination module, configured to determine, in response to a start-up operation of a target function, a plurality of resource packages corresponding to the target function; wherein the resource package at least includes dependency information and resources; the dependency information includes an identifier of each resource package having a dependency relationship with the entity resource package; A dependent resource package determination module, used to determine each dependent resource package having a dependency relationship with the target resource package based on each of the identifiers in the dependency information in the target resource package; wherein the target resource package is any one of the resource packages; The resource loading module is used to load the resources in the target resource package and the resources with dependency relationships in each of the dependent resource packages into the memory, and generate memory data corresponding to the target function.
9. An electronic device, characterized in that: include: processor; A memory for storing executable instructions; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the resource processing method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the resource processing method described in any one of claims 1 to 7.
11. A computer program product, characterized in that The computer program product is used to implement the resource processing method described in any one of claims 1 to 7.